Home | History | Annotate | Download | only in bionic

Lines Matching refs:Year

76 typedef int64_t  Year;
107 static const Year years_in_gregorian_cycle = 400;
111 /* Year range we can trust the time funcitons with */
115 /* 28 year Julian calendar cycle */
118 /* Year cycle from MAX_SAFE_YEAR down. */
129 /* Year cycle from MIN_SAFE_YEAR up */
183 static int is_exception_century(Year year)
185 int is_exception = ((year % 100 == 0) && !(year % 400 == 0));
199 Year year;
200 Year orig_year = (Year)date->tm_year;
216 year = 70;
217 while( year < orig_year ) {
218 days += length_of_year[IS_LEAP(year)];
219 year++;
223 year = 69;
225 days -= length_of_year[IS_LEAP(year)];
226 year--;
227 } while( year >= orig_year );
282 static Year cycle_offset(Year year)
284 const Year start_year = 2000;
285 Year year_diff = year - start_year;
286 Year exceptions;
288 if( year > start_year )
294 TRACE3("# year: %lld, exceptions: %lld, year_diff: %lld\n",
295 year, exceptions, year_diff);
300 /* For a given year after 2038, pick the latest possible matching
301 year in the 28 year calendar cycle.
303 A matching year...
305 2) Has the same leap year status.
309 Also the previous year must match. When doing Jan 1st you might
310 wind up on Dec 31st the previous year when doing a -UTC time zone.
312 Finally, the next year must have the same start day of week. This
314 It doesn't need the same leap year status since we only care about
317 static int safe_year(const Year year)
320 Year year_cycle;
322 if( year >= MIN_SAFE_YEAR && year <= MAX_SAFE_YEAR ) {
323 return (int)year;
326 year_cycle = year + cycle_offset(year);
329 if( year < MIN_SAFE_YEAR )
333 if( is_exception_century(year) )
336 /* Also xx01 years, since the previous year will be wrong */
337 if( is_exception_century(year - 1) )
346 if( year < MIN_SAFE_YEAR )
348 else if( year > MAX_SAFE_YEAR )
353 TRACE3("# year: %lld, year_cycle: %lld, safe_year: %d\n",
354 year, year_cycle, safe_year);
373 dest->tm_year = (Year)src->tm_year;
461 static Time64_T seconds_between_years(Year left_year, Year right_year) {
490 Year year = input_date->tm_year + 1900;
492 if( MIN_SAFE_YEAR <= year && year <= MAX_SAFE_YEAR ) {
497 /* Have to make the year safe in date else it won't fit in safe_date */
499 date.tm_year = safe_year(year) - 1900;
504 time += seconds_between_years(year, (Year)(safe_date.tm_year + 1900));
523 Year year = 70;
567 year = CHEAT_YEARS;
576 year += (cycles * years_in_gregorian_cycle);
580 leap = IS_LEAP (year);
583 year++;
584 leap = IS_LEAP (year);
594 year--;
600 year += (cycles * years_in_gregorian_cycle);
604 leap = IS_LEAP (year);
607 year--;
608 leap = IS_LEAP (year);
620 p->tm_year = year;
621 if( p->tm_year != year ) {
628 /* At this point m is less than a year so casting to an int is safe */
648 Year orig_year;
678 TRACE1("Mapping tm_year %lld to safe_year\n", (Year)gm_tm.tm_year);
679 gm_tm.tm_year = safe_year((Year)(gm_tm.tm_year + 1900)) - 1900;
693 (Year)local_tm->tm_year, (Year)orig_year);
704 /* When localtime is Dec 31st previous year and
705 gmtime is Jan 1st next year.
711 /* When localtime is Jan 1st, next year and
712 gmtime is Dec 31st, previous year.
718 /* GMT is Jan 1st, xx01 year, but localtime is still Dec 31st
720 we can't account for which the safe xx00 year is a leap
721 year. So we need to correct for Dec 31st comming out as
722 the 366th day of the year.