Lines Matching +full:start +full:- +full:year
2 * CDDL HEADER START
23 * Copyright (c) 1987-2000 by Sun Microsystems, Inc.
58 invalid_inter = gettext("invalid date/time format -"); in do_invalid()
63 * .func local_to_gm - local time to gm time.
72 * correction is applied - it is assumed that if we can produce
78 * a year when time occurs twice (in the fall) and one local hour a
79 * year when time never occurs (in the spring).
84 * .arg tme - ptr to struct tm (see time.h) containing local time.
85 * .ret time_t - seconds since epoch of equivalent GMT.
108 secs = lsecs - gsecs; in local_to_gm()
109 gsecs -= secs; in local_to_gm()
129 gsecs -= r2secs - r1secs; in local_to_gm()
131 gsecs += r1secs - r2secs; in local_to_gm()
141 * and the user-given local time never happened. in local_to_gm()
153 * .func tm_to_secs - convert to seconds.
159 * .arg tme - ptr to tm structure.
160 * .ret time_t - number of seconds.
169 int sec = tme->tm_sec; in tm_to_secs()
170 int min = tme->tm_min; in tm_to_secs()
171 int hour = tme->tm_hour; in tm_to_secs()
172 int day = tme->tm_mday; in tm_to_secs()
173 int month = tme->tm_mon; in tm_to_secs()
174 int year = tme->tm_year + 1900; in tm_to_secs() local
176 if (days_in_year(year) == 366) in tm_to_secs()
179 while (year > 1970) { in tm_to_secs()
180 num_sec += days_in_year(--year) * 24 * 60 * 60; in tm_to_secs()
183 days = days_month[--month]; in tm_to_secs()
189 num_sec += --day * 24 * 60 * 60; in tm_to_secs()
199 * .func check_time - check tm structure.
203 * .arg tme - ptr to struct tm (see time.h).
204 * .ret 0 - time is ok.
205 * .ret -1 - time had a problem (description in error_str).
212 if (tme->tm_sec < 0 || tme->tm_sec > 59) { in check_time()
214 gettext("seconds out of range (%d)"), tme->tm_sec + 1); in check_time()
216 } else if (tme->tm_min < 0 || tme->tm_min > 59) { in check_time()
218 gettext("minutes out of range (%d)"), tme->tm_min + 1); in check_time()
220 } else if (tme->tm_hour < 0 || tme->tm_hour > 23) { in check_time()
222 gettext("hours out of range (%d)"), tme->tm_hour + 1); in check_time()
224 } else if (tme->tm_mon < 0 || tme->tm_mon > 11) { in check_time()
226 gettext("months out of range (%d)"), tme->tm_mon + 1); in check_time()
228 } else if (tme->tm_year < 0) { in check_time()
230 gettext("years out of range (%d)"), tme->tm_year); in check_time()
232 } else if (tme->tm_mday < 1 || tme->tm_mday > days_month[tme->tm_mon]) { in check_time()
233 if (!(days_in_year(tme->tm_year + 1900) == 366 && in check_time()
234 tme->tm_mon == 1 && in check_time()
235 tme->tm_mday == 29)) { /* leap year and February */ in check_time()
237 gettext("days out of range (%d)"), tme->tm_mday); in check_time()
240 } else if (tme->tm_wday < 0 || tme->tm_wday > 6) { in check_time()
242 gettext("weekday out of range (%d)"), tme->tm_wday); in check_time()
244 } else if (tme->tm_yday < 0 || tme->tm_yday > 365) { in check_time()
246 gettext("day of year out of range (%d)"), tme->tm_yday); in check_time()
253 return (-1); in check_time()
262 * 1. +xt - where x is a number and t is a type.
263 * types are - 's' second, 'm' minute, 'h' hour, and 'd' day.
264 * 2. yymmdd - yyyymmdd.
265 * yymmddhh - yyyymmddhh.
266 * yymmddhhmm - yyyymmddhhmm.
267 * yymmddhhmmss - yyyymmddhhmmss.
269 * .arg str - ptr to user input string.
270 * .arg opt - time option being processed.
271 * .ret 0 - succesful.
272 * .ret -1 - failure (error message in error_str).
284 * If the strlen < 6 then in the "-b +2d" type of format. in parse_time()
291 return (-1); in parse_time()
298 return (-1); in parse_time()
302 gettext("must have -a to use -b +nx form (%s)"), in parse_time()
305 return (-1); in parse_time()
308 * Find out what type of offset it is - 's' 'm' 'h' or 'd'. in parse_time()
316 return (-1); in parse_time()
323 gettext("%s non-numeric offset (%s)"), in parse_time()
326 return (-1); in parse_time()
343 return (-1); in parse_time()
345 * For 'd' option clear out the hh:mm:ss to get to the start of the day. in parse_time()
372 * .arg str - ptr to input string.
373 * .arg tme - ptr to tm structure (time.h).
374 * .ret 0 - no errors in string.
375 * .ret -1 - errors in string (description in error_str).
391 return (-1); in derive_date()
397 return (-1); in derive_date()
410 * If the year does not begin with '19' or '20', then report in derive_date()
415 (void) sprintf(errbuf, gettext("invalid year (%c%c%c%c)"), in derive_date()
419 return (-1); in derive_date()
428 return (-1); in derive_date()
434 tme->tm_year = atoi(strs) - 1900; /* get the year */ in derive_date()
437 tme->tm_mon = atoi(strs) - 1; /* get months */ in derive_date()
440 tme->tm_mday = atoi(strs); /* get days */ in derive_date()
444 tme->tm_hour = atoi(strs); /* get hours */ in derive_date()
449 tme->tm_min = atoi(strs); /* get minutes */ in derive_date()
454 tme->tm_sec = atoi(strs); /* get seconds */ in derive_date()
462 * .func derive_str - derive string.
466 * .arg clock - seconds since epoch.
467 * .arg buf - place to put resultant string.
488 days_in_year(int year) in days_in_year() argument
490 if (isleap(year)) in days_in_year()