当前位置: 首页>>代码示例>>C++>>正文


C++ IsLeapYear函数代码示例

本文整理汇总了C++中IsLeapYear函数的典型用法代码示例。如果您正苦于以下问题:C++ IsLeapYear函数的具体用法?C++ IsLeapYear怎么用?C++ IsLeapYear使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了IsLeapYear函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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


注:本文中的IsLeapYear函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。