Home | History | Annotate | Download | only in wtf

Lines Matching refs:year

110 // Day of year for the first day of each month, where index 0 is January, and day 0 is January 1.
126 bool isLeapYear(int year)
128 if (year % 4 != 0)
130 if (year % 400 == 0)
132 if (year % 100 == 0)
137 static inline int daysInYear(int year)
139 return 365 + isLeapYear(year);
142 static inline double daysFrom1970ToYear(int year)
145 // Every fourth year is a leap year. 2004, 2008, and 2012 are leap years.
146 // However, every hundredth year is not a leap year. 1900 and 2100 are not leap years.
147 // Every four hundred years, there's a leap year after all. 2000 and 2400 are leap years.
153 const double yearMinusOne = year - 1;
158 return 365.0 * (year - 1970) + yearsToAddBy4Rule - yearsToExcludeBy100Rule + yearsToAddBy400Rule;
185 int dayInYear(double ms, int year)
187 return static_cast<int>(msToDays(ms) - daysFrom1970ToYear(year));
285 int dayInYear(int year, int month, int day)
287 return firstDayOfMonth[isLeapYear(year)][month] + day - 1;
290 double dateToDaysFrom1970(int year, int month, int day)
292 year += month / 12;
297 --year;
300 double yearday = floor(daysFrom1970ToYear(year));
301 ASSERT((year >= 1970 && yearday >= 0) || (year < 1970 && yearday < 0));
302 return yearday + dayInYear(year, month, day);
320 // Because of the 2038 issue (see maximumYearForDST) if the current year is
321 // greater than the max year minus 27 (2010), we want to use the max year
328 * Find an equivalent year for the one given, where equivalence is deterined by
329 * the two years having the same leapness and the first day of the year, falling
332 * This function returns a year between this current year and 2037, however this
333 * function will potentially return incorrect results if the current year is after
334 * 2010, (rdar://problem/5052975), if the year passed in is before 1900 or after
337 static int equivalentYearForDST(int year)
339 // It is ok if the cached year is not the current year as long as the rules
346 if (year > maxYear)
347 difference = minYear - year;
348 else if (year < minYear)
349 difference = maxYear - year;
351 return year;
356 year += product;
357 ASSERT((year >= minYear && year <= maxYear) || (product - year == static_cast<int>(std::numeric_limits<double>::quiet_NaN())));
358 return year;
373 // Get the difference between this time zone and UTC on the 1st of January of this year.
441 int year = msToYear(ms);
442 int equivalentYear = equivalentYearForDST(year);
443 if (year != equivalentYear) {
444 bool leapYear = isLeapYear(year);
445 int dayInYearLocal = dayInYear(ms, year);
466 static inline double ymdhmsToSeconds(int year, long mon, long day, long hour, long minute, double second)
469 + floor(1461 * (year + 4800.0 + (mon - 14) / 12) / 4)
471 - floor(3 * ((year + 4900.0 + (mon - 14) / 12) / 100) / 4)
612 int year = 0;
622 year = static_cast<int>(day);
676 if (year <= 0 && *dateString) {
677 if (!parseInt(dateString, &newPosStr, 10, &year))
692 // There was no year; the number was the hour.
693 year = -1;
695 // in the normal case (we parsed the year), advance to the next number
762 // The year may be after the time but before the time zone.
763 if (isASCIIDigit(*dateString) && year == -1) {
764 if (!parseInt(dateString, &newPosStr, 10, &year))
817 if (*dateString && year == -1) {
818 if (!parseInt(dateString, &newPosStr, 10, &year))
829 if (year >= 0 && year < 100) {
830 if (year < 50)
831 year += 2000;
833 year += 1900;
836 return ymdhmsToSeconds(year, month + 1, day, hour, minute, second) * msPerSecond;
857 String makeRFC2822DateString(unsigned dayOfWeek, unsigned day, unsigned month, unsigned year, unsigned hours, unsigned minutes, unsigned seconds, int utcOffset)
866 stringBuilder.appendNumber(year);