Home | History | Annotate | Download | only in nspr

Lines Matching refs:time

42  *     NSPR date and time functions
76 #include <time.h>
80 static void localtime_r(const time_t* secs, struct tm* time) {
81 (void) localtime_s(time, secs);
102 // Create the system struct representing our exploded time.
117 NOTREACHED() << "Unable to convert time";
127 // Adjust for time zone and dst. Convert from seconds to microseconds.
132 // Create the system struct representing our exploded time.
164 // If timegm returned -1. Since we don't pass it a time zone, the only
253 * 'time' should point to a normalized PRExplodedTime.
257 ApplySecOffset(PRExplodedTime *time, PRInt32 secOffset)
259 time->tm_sec += secOffset;
262 if (time->tm_sec < 0 || time->tm_sec >= 60) {
263 time->tm_min += time->tm_sec / 60;
264 time->tm_sec %= 60;
265 if (time->tm_sec < 0) {
266 time->tm_sec += 60;
267 time->tm_min--;
271 if (time->tm_min < 0 || time->tm_min >= 60) {
272 time->tm_hour += time->tm_min / 60;
273 time->tm_min %= 60;
274 if (time->tm_min < 0) {
275 time->tm_min += 60;
276 time->tm_hour--;
280 if (time->tm_hour < 0) {
282 time->tm_hour += 24;
283 time->tm_mday--;
284 time->tm_yday--;
285 if (time->tm_mday < 1) {
286 time->tm_month--;
287 if (time->tm_month < 0) {
288 time->tm_month = 11;
289 time->tm_year--;
290 if (IsLeapYear(time->tm_year))
291 time->tm_yday = 365;
293 time->tm_yday = 364;
295 time->tm_mday = nDays[IsLeapYear(time->tm_year)][time->tm_month];
297 time->tm_wday--;
298 if (time->tm_wday < 0)
299 time->tm_wday = 6;
300 } else if (time->tm_hour > 23) {
302 time->tm_hour -= 24;
303 time->tm_mday++;
304 time->tm_yday++;
305 if (time->tm_mday >
306 nDays[IsLeapYear(time->tm_year)][time->tm_month]) {
307 time->tm_mday = 1;
308 time->tm_month++;
309 if (time->tm_month > 11) {
310 time->tm_month = 0;
311 time->tm_year++;
312 time->tm_yday = 0;
315 time->tm_wday++;
316 if (time->tm_wday > 6)
317 time->tm_wday = 0;
322 PR_NormalizeTime(PRExplodedTime *time, PRTimeParamFn params)
328 time->tm_sec -= time->tm_params.tp_gmt_offset
329 + time->tm_params.tp_dst_offset;
330 time->tm_params.tp_gmt_offset = 0;
331 time->tm_params.tp_dst_offset = 0;
335 if (time->tm_usec < 0 || time->tm_usec >= 1000000) {
336 time->tm_sec += time->tm_usec / 1000000;
337 time->tm_usec %= 1000000;
338 if (time->tm_usec < 0) {
339 time->tm_usec += 1000000;
340 time->tm_sec--;
345 if (time->tm_sec < 0 || time->tm_sec >= 60) {
346 time->tm_min += time->tm_sec / 60;
347 time->tm_sec %= 60;
348 if (time->tm_sec < 0) {
349 time->tm_sec += 60;
350 time->tm_min--;
354 if (time->tm_min < 0 || time->tm_min >= 60) {
355 time->tm_hour += time->tm_min / 60;
356 time->tm_min %= 60;
357 if (time->tm_min < 0) {
358 time->tm_min += 60;
359 time->tm_hour--;
363 if (time->tm_hour < 0 || time->tm_hour >= 24) {
364 time->tm_mday += time->tm_hour / 24;
365 time->tm_hour %= 24;
366 if (time->tm_hour < 0) {
367 time->tm_hour += 24;
368 time->tm_mday--;
373 if (time->tm_month < 0 || time->tm_month >= 12) {
374 time->tm_year += time->tm_month / 12;
375 time->tm_month %= 12;
376 if (time->tm_month < 0) {
377 time->tm_month += 12;
378 time->tm_year--;
384 if (time->tm_mday < 1) {
388 time->tm_month--;
389 if (time->tm_month < 0) {
390 time->tm_month = 11;
391 time->tm_year--;
393 time->tm_mday += nDays[IsLeapYear(time->tm_year)][time->tm_month];
394 } while (time->tm_mday < 1);
396 daysInMonth = nDays[IsLeapYear(time->tm_year)][time->tm_month];
397 while (time->tm_mday > daysInMonth) {
399 time->tm_mday -= daysInMonth;
400 time->tm_month++;
401 if (time->tm_month > 11) {
402 time->tm_month = 0;
403 time->tm_year++;
405 daysInMonth = nDays[IsLeapYear(time->tm_year)][time->tm_month];
410 time->tm_yday = time->tm_mday +
411 lastDayOfMonth[IsLeapYear(time->tm_year)][time->tm_month];
413 numDays = DAYS_BETWEEN_YEARS(1970, time->tm_year) + time->tm_yday;
414 time->tm_wday = (numDays + 4) % 7;
415 if (time->tm_wday < 0) {
416 time->tm_wday += 7;
419 /* Recompute time parameters */
421 time->tm_params = params(time);
423 ApplySecOffset(time, time->tm_params.tp_gmt_offset
424 + time->tm_params.tp_dst_offset);
432 * Returns the PRTimeParameters for Greenwich Mean Time.
455 * We only recognize the abbreviations of a small subset of time zones
458 * PST/PDT: Pacific Standard/Daylight Time
459 * MST/MDT: Mountain Standard/Daylight Time
460 * CST/CDT: Central Standard/Daylight Time
461 * EST/EDT: Eastern Standard/Daylight Time
462 * AST: Atlantic Standard Time
463 * NST: Newfoundland Standard Time
464 * GMT: Greenwich Mean Time
465 * BST: British Summer Time
466 * MET: Middle Europe Time
467 * EET: Eastern Europe Time
468 * JST: Japan Standard Time
485 * This parses a time/date string into a PRTime
488 * if the time/date string can't be parsed.
510 * be interpreted relative to the local time zone (PR_FALSE) or GMT (PR_TRUE).
512 * the time string which you are parsing.
839 directly following the time.
1098 * Mainly to compute wday and yday, but normalized time is also required
1126 * time, we call mktime(). However, we need to see if we are
1132 * do so if mktime() returns (time_t) -1 (time out of range).
1156 * after 23:59:59, December 31, 3000, US Pacific Time (not
1164 * out of range. To use a simple test that works in any time