Home | History | Annotate | Download | only in wtf

Lines Matching full:year

128 // Day of year for the first day of each month, where index 0 is January, and day 0 is January 1.
135 static inline bool isLeapYear(int year)
137 if (year % 4 != 0)
139 if (year % 400 == 0)
141 if (year % 100 == 0)
146 static inline int daysInYear(int year)
148 return 365 + isLeapYear(year);
151 static inline double daysFrom1970ToYear(int year)
154 // Every fourth year is a leap year. 2004, 2008, and 2012 are leap years.
155 // However, every hundredth year is not a leap year. 1900 and 2100 are not leap years.
156 // Every four hundred years, there's a leap year after all. 2000 and 2400 are leap years.
162 const double yearMinusOne = year - 1;
167 return 365.0 * (year - 1970) + yearsToAddBy4Rule - yearsToExcludeBy100Rule + yearsToAddBy400Rule;
186 int dayInYear(double ms, int year)
188 return static_cast<int>(msToDays(ms) - daysFrom1970ToYear(year));
313 double dateToDaysFrom1970(int year, int month, int day)
315 year += month / 12;
320 --year;
323 double yearday = floor(daysFrom1970ToYear(year));
324 ASSERT((year >= 1970 && yearday >= 0) || (year < 1970 && yearday < 0));
325 int monthday = monthToDayInYear(month, isLeapYear(year));
339 // Because of the 2038 issue (see maximumYearForDST) if the current year is
340 // greater than the max year minus 27 (2010), we want to use the max year
347 * Find an equivalent year for the one given, where equivalence is deterined by
348 * the two years having the same leapness and the first day of the year, falling
351 * This function returns a year between this current year and 2037, however this
352 * function will potentially return incorrect results if the current year is after
353 * 2010, (rdar://problem/5052975), if the year passed in is before 1900 or after
356 int equivalentYearForDST(int year)
358 // It is ok if the cached year is not the current year as long as the rules
365 if (year > maxYear)
366 difference = minYear - year;
367 else if (year < minYear)
368 difference = maxYear - year;
370 return year;
375 year += product;
376 ASSERT((year >= minYear && year <= maxYear) || (product - year == static_cast<int>(NaN)));
377 return year;
390 // Get the difference between this time zone and UTC on the 1st of January of this year.
457 int year = msToYear(ms);
458 int equivalentYear = equivalentYearForDST(year);
459 if (year != equivalentYear) {
460 bool leapYear = isLeapYear(year);
461 int dayInYearLocal = dayInYear(ms, year);
482 static inline double ymdhmsToSeconds(long year, int mon, int day, int hour, int minute, int second)
485 + floor(1461 * (year + 4800.0 + (mon - 14) / 12) / 4)
487 - floor(3 * ((year + 4900.0 + (mon - 14) / 12) / 100) / 4)
618 long year = 0;
626 year = day;
680 if (year <= 0 && *dateString) {
681 if (!parseLong(dateString, &newPosStr, 10, &year))
696 // There was no year; the number was the hour.
697 year = -1;
699 // in the normal case (we parsed the year), advance to the next number
809 if (*dateString && year == -1) {
810 if (!parseLong(dateString, &newPosStr, 10, &year))
822 if (year >= 0 && year < 100) {
823 if (year < 50)
824 year += 2000;
826 year += 1900;
829 return ymdhmsToSeconds(year, month + 1, day, hour, minute, second) * msPerSecond;
939 double day = dateToDaysFrom1970(t.year + 1900, t.month, t.monthDay);
963 const int year = msToYear(ms);
968 tm.yearDay = dayInYear(ms, year);
969 tm.monthDay = dayInMonthFromDayInYear(tm.yearDay, isLeapYear(year));
970 tm.month = monthFromDayInYear(tm.yearDay, isLeapYear(year));
971 tm.year = year - 1900;