本文整理汇总了C++中IsLeapYear函数的典型用法代码示例。如果您正苦于以下问题:C++ IsLeapYear函数的具体用法?C++ IsLeapYear怎么用?C++ IsLeapYear使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了IsLeapYear函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: GetDateFromTimeValue
int DateTime::DayOfYear() const
{
int year, month, day;
GetDateFromTimeValue( Value(), year, month, day);
const unsigned* monthTable = IsLeapYear(year) ? monthStartLeap : monthStart;
return monthTable[ month - 1 ] + day;
}
开发者ID:nettashani,项目名称:annotation-and-image-markup,代码行数:8,代码来源:xs-datetime.cpp
示例2: DecodeDate
int TDateTime::IsLeapYear()
{
unsigned int year=0;
unsigned int month=0;
unsigned int day=0;
DecodeDate(year, month, day);
return IsLeapYear(year);
}
开发者ID:zhangchaoyangaisino,项目名称:CJ_FWSK_MIDDLEWARE_1.0000,代码行数:8,代码来源:TDateTime.cpp
示例3: DayFromMonth
static double DayFromMonth(double year, double month)
{
int iMonth = (int) MathUtils::floor(month);
if (iMonth < 0 || iMonth >= 12) {
return MathUtils::kNaN;
}
return DayFromYear((int)year) + kMonthOffset[(int)IsLeapYear((int)year)][iMonth];
}
开发者ID:bsdf,项目名称:trx,代码行数:8,代码来源:Date.cpp
示例4: DayOfYear
int Date::DayOfYear(int year, int month, int day)
{
static const int DAYS_BEFORE[2][13] = {
{ -1, 0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334 },
{ -1, 0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335 }
};
return DAYS_BEFORE[IsLeapYear(year)][month] + day - 1;
}
开发者ID:haroldzmli,项目名称:cuboid,代码行数:9,代码来源:Date.cpp
示例5: DaysInMonth
int Date::DaysInMonth(int year, int month)
{
static const int DAYS_IN_MONTH[2][13] = {
{ 0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 },
{ 0, 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }
};
return DAYS_IN_MONTH[IsLeapYear(year)][month];
}
开发者ID:haroldzmli,项目名称:cuboid,代码行数:9,代码来源:Date.cpp
示例6: GetAfterTwoMonthDay
Calendar Calendar::GetAfterTwoMonthDay() const {
if (this->Month == 12) {
if (!IsLeapYear(this->Year + 1)) return this->Day >= 28 ? Calendar(this->Year + 1, 2, 28) : Calendar(this->Year + 1, 2, this->Day);
else return this->Day >= 29 ? Calendar(this->Year + 1, 2, 29) : Calendar(this->Year + 1, 2, this->Day);
}
else if (this->Month == 11) return Calendar(this->Year + 1, 1, this->Day);
else if (this->Month == 7 && this->Day == 31) return Calendar(this->Year, 9, 30);
else return Calendar(this->Year, this->Month + 2, this->Day);
}
开发者ID:AinoMegumi,项目名称:WeAreTokyoRevenueInspectionUnit,代码行数:9,代码来源:Calendar.cpp
示例7: Calendar
Calendar Calendar::GetAfterAWeekDay() const {
auto AfterAWeekDate = [this](const int AbleToSimpleAddBorderDay) {
return this->Day <= AbleToSimpleAddBorderDay ? Calendar(this->Year, this->Month, this->Day + 7) : Calendar(this->Year, Month + 1, this->Day - AbleToSimpleAddBorderDay);
};
if (this->Month == 12 && this->Day > 24) return Calendar(this->Year + 1, 1, this->Day - 24);
else if (!IsNo31Month(this->Month)) return AfterAWeekDate(24);
else if (this->Month != 2) return AfterAWeekDate(23);
else return AfterAWeekDate((IsLeapYear(this->Year) ? 22 : 21));
}
开发者ID:AinoMegumi,项目名称:WeAreTokyoRevenueInspectionUnit,代码行数:9,代码来源:Calendar.cpp
示例8: DaysInYear
int32 FDateTime::DaysInYear( int32 Year )
{
if (IsLeapYear(Year))
{
return 366;
}
return 365;
}
开发者ID:1vanK,项目名称:AHRUnrealEngine,代码行数:9,代码来源:DateTime.cpp
示例9: NextDay
void NextDay(){
day++;
if(day>DayOfMonth[month][IsLeapYear(year)]){
day=1;month++;
}
if(month>12){
month=1;year++;
}
}
开发者ID:KeyOfSpectator,项目名称:PAT_old,代码行数:9,代码来源:MainCPP.cpp
示例10: ValidDay
STATIC
BOOLEAN
ValidDay (
IN EFI_TIME time
)
{
if (time.Day > DayOfMonth[time.Month - 1]) {
return FALSE;
}
//
// Pay attention to month==2
//
if (time.Month == 2 && ((IsLeapYear (time) && time.Day > 29) || (!IsLeapYear (time) && time.Day > 28))) {
return FALSE;
}
return TRUE;
}
开发者ID:DYX884877791,项目名称:edk-Shell,代码行数:18,代码来源:date.c
示例11: MonthDayMax
// ////////////////////////////////////////////////////////////////////////////
inline unsigned int MonthDayMax(unsigned int in_year, unsigned int in_month)
{
return((!YearMonthOk(in_year, in_month)) ? 0 :
(((in_month == 1) || (in_month == 3) ||
(in_month == 5) || (in_month == 7) || (in_month == 8) ||
(in_month == 10) || (in_month == 12)) ? 31 : ((in_month == 4) ||
(in_month == 6) || (in_month == 9) || (in_month == 11)) ? 30 :
(28 + ((IsLeapYear(in_year)) ? 1 : 0))));
}
开发者ID:mlbrock,项目名称:MlbDev,代码行数:10,代码来源:DateTimeCheckSupport.hpp
示例12: IsDayValid
STATIC
BOOLEAN
EFIAPI
IsDayValid (
IN EFI_TIME *Time
)
{
ASSERT (Time->Day >= 1);
ASSERT (Time->Day <= mDayOfMonth[Time->Month - 1]);
ASSERT (Time->Month != 2 || IsLeapYear (Time) || Time->Day <= 28);
if (Time->Day < 1 ||
Time->Day > mDayOfMonth[Time->Month - 1] ||
(Time->Month == 2 && !IsLeapYear (Time) && Time->Day > 28)) {
return FALSE;
}
return TRUE;
}
开发者ID:lersek,项目名称:edk2,代码行数:18,代码来源:RealTimeClock.c
示例13: MonthDays
int CMyCalendar::MonthDays(int year,int month)
{
if(month==2)
{
if(IsLeapYear(year))
return 29;
return 28;
}
return sMonthDays[month];
}
开发者ID:almondyoung,项目名称:MyLibOfMySelf,代码行数:10,代码来源:MyTime.cpp
示例14: IsLeapYear
unsigned CTimer::GetDaysOfMonth (unsigned nMonth, unsigned nYear)
{
if ( nMonth == 1
&& IsLeapYear (nYear))
{
return 29;
}
return s_nDaysOfMonth[nMonth];
}
开发者ID:rollingstone,项目名称:circle,代码行数:10,代码来源:timer.cpp
示例15: switch
//returns the length of any month, ie length of November would be 30
int cTimeAndDate::LengthOfMonth(int month) const {
int ret=-1;
switch(month) {
case 9: case 4: case 6: case 11: ret=30; break;
case 1: case 3: case 5: case 7: case 8: case 10: case 12: ret=31; break;
case 2: if(IsLeapYear()) ret=29; else ret=28; break;
default: ret=-1; //invalid month
}
return ret;
}
开发者ID:cmd184psu,项目名称:fs-tools,代码行数:11,代码来源:timeanddate.cpp
示例16: RtlTimeFieldsToTime
/******************************************************************************
* RtlTimeFieldsToTime [[email protected]]
*
*/
BOOLEAN WINAPI RtlTimeFieldsToTime(
PTIME_FIELDS tfTimeFields,
PLARGE_INTEGER Time)
{
int CurYear, CurMonth;
long long int rcTime;
TIME_FIELDS TimeFields = *tfTimeFields;
rcTime = 0;
/* FIXME: normalize the TIME_FIELDS structure here */
while (TimeFields.Second >= SECSPERMIN)
{ NormalizeTimeFields(&TimeFields.Second, &TimeFields.Minute, SECSPERMIN);
}
while (TimeFields.Minute >= MINSPERHOUR)
{ NormalizeTimeFields(&TimeFields.Minute, &TimeFields.Hour, MINSPERHOUR);
}
while (TimeFields.Hour >= HOURSPERDAY)
{ NormalizeTimeFields(&TimeFields.Hour, &TimeFields.Day, HOURSPERDAY);
}
while (TimeFields.Day > MonthLengths[IsLeapYear(TimeFields.Year)][TimeFields.Month - 1])
{ NormalizeTimeFields(&TimeFields.Day, &TimeFields.Month, SECSPERMIN);
}
while (TimeFields.Month > MONSPERYEAR)
{ NormalizeTimeFields(&TimeFields.Month, &TimeFields.Year, MONSPERYEAR);
}
/* FIXME: handle calendar corrections here */
for (CurYear = EPOCHYEAR; CurYear < TimeFields.Year; CurYear++)
{ rcTime += YearLengths[IsLeapYear(CurYear)];
}
for (CurMonth = 1; CurMonth < TimeFields.Month; CurMonth++)
{ rcTime += MonthLengths[IsLeapYear(CurYear)][CurMonth - 1];
}
rcTime += TimeFields.Day - 1;
rcTime *= SECSPERDAY;
rcTime += TimeFields.Hour * SECSPERHOUR + TimeFields.Minute * SECSPERMIN + TimeFields.Second;
rcTime *= TICKSPERSEC;
rcTime += TimeFields.Milliseconds * TICKSPERMSEC;
*Time = *(LARGE_INTEGER *)&rcTime;
return TRUE;
}
开发者ID:NVIDIA,项目名称:winex_lgpl,代码行数:47,代码来源:time.c
示例17: ConvertYMDToDate
/**
* Converts a tuple of Year, Month and Day to a Date.
* @param year is a number between 0..MAX_YEAR
* @param month is a number between 0..11
* @param day is a number between 1..31
*/
Date ConvertYMDToDate(Year year, Month month, Day day)
{
/* Day-offset in a leap year */
int days = _accum_days_for_month[month] + day - 1;
/* Account for the missing of the 29th of February in non-leap years */
if (!IsLeapYear(year) && days >= ACCUM_MAR) days--;
return DAYS_TILL(year) + days;
}
开发者ID:Ayutac,项目名称:OpenTTD,代码行数:16,代码来源:date.cpp
示例18: DayRank
int DayRank(int year, int month, int date)
{
int days = 0, i;
int flag = IsLeapYear(year);
if (flag) MONTH[1] = 29;
else MONTH[1] = 28;
for (i = 0; i < month - 1; ++i) days += MONTH[i];
days += date;
return days;
}
开发者ID:python27,项目名称:AlgorithmSolution,代码行数:10,代码来源:2005.c
示例19: main
int main(int argc, char* argv[]){
int year = 0;
if(argc == 2)
year = atoi(argv[1]);
if(IsLeapYear(year))
printf("%d is a leap year\n", year);
else
printf("%d is not a leap year\n", year);
return 0;
}
开发者ID:tymadsen,项目名称:course-code,代码行数:11,代码来源:prob1.c
示例20: IsLeapYear
int Date::Get() const
{
if(IsNull(*this))
return Null;
int y400 = (year / 400 ) - 2;
int ym = year - y400 * 400;
return y400 * (400 * 365 + 100 - 3) +
ym * 365 + s_month_off[month - 1] + (day - 1) +
(ym - 1) / 4 - (ym - 1) / 100 + (ym - 1) / 400 + 1 +
(month > 2) * IsLeapYear(ym);
}
开发者ID:dreamsxin,项目名称:ultimatepp,代码行数:11,代码来源:TimeDate.cpp
注:本文中的IsLeapYear函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论