localtime.c (130461) | localtime.c (134231) |
---|---|
1/* 2** This file is in the public domain, so clarified as of 3** 1996-06-05 by Arthur David Olson (arthur_david_olson@nih.gov). 4*/ 5 6#include <sys/cdefs.h> 7#ifndef lint 8#ifndef NOID 9static char elsieid[] __unused = "@(#)localtime.c 7.78"; 10#endif /* !defined NOID */ 11#endif /* !defined lint */ | 1/* 2** This file is in the public domain, so clarified as of 3** 1996-06-05 by Arthur David Olson (arthur_david_olson@nih.gov). 4*/ 5 6#include <sys/cdefs.h> 7#ifndef lint 8#ifndef NOID 9static char elsieid[] __unused = "@(#)localtime.c 7.78"; 10#endif /* !defined NOID */ 11#endif /* !defined lint */ |
12__FBSDID("$FreeBSD: head/lib/libc/stdtime/localtime.c 130461 2004-06-14 10:31:52Z stefanf $"); | 12__FBSDID("$FreeBSD: head/lib/libc/stdtime/localtime.c 134231 2004-08-24 00:15:37Z peter $"); |
13 14/* 15** Leap second handling from Bradley White (bww@k.gp.cs.cmu.edu). 16** POSIX-style TZ environment variable handling from Guy Harris 17** (guy@auspex.com). 18*/ 19 20/*LINTLIBRARY*/ --- 1461 unchanged lines hidden (view full) --- 1482 if (++yourtm.tm_mon >= MONSPERYEAR) { 1483 yourtm.tm_mon = 0; 1484 if (increment_overflow(&yourtm.tm_year, 1)) 1485 return WRONG; 1486 } 1487 } 1488 if (increment_overflow(&yourtm.tm_year, -TM_YEAR_BASE)) 1489 return WRONG; | 13 14/* 15** Leap second handling from Bradley White (bww@k.gp.cs.cmu.edu). 16** POSIX-style TZ environment variable handling from Guy Harris 17** (guy@auspex.com). 18*/ 19 20/*LINTLIBRARY*/ --- 1461 unchanged lines hidden (view full) --- 1482 if (++yourtm.tm_mon >= MONSPERYEAR) { 1483 yourtm.tm_mon = 0; 1484 if (increment_overflow(&yourtm.tm_year, 1)) 1485 return WRONG; 1486 } 1487 } 1488 if (increment_overflow(&yourtm.tm_year, -TM_YEAR_BASE)) 1489 return WRONG; |
1490 /* Don't go below 1900 for POLA */ 1491 if (yourtm.tm_year < 0) 1492 return WRONG; |
|
1490 if (yourtm.tm_sec >= 0 && yourtm.tm_sec < SECSPERMIN) 1491 saved_seconds = 0; 1492 else if (yourtm.tm_year + TM_YEAR_BASE < EPOCH_YEAR) { 1493 /* 1494 ** We can't set tm_sec to 0, because that might push the 1495 ** time below the minimum representable time. 1496 ** Set tm_sec to 59 instead. 1497 ** This assumes that the minimum representable time is --- 313 unchanged lines hidden --- | 1493 if (yourtm.tm_sec >= 0 && yourtm.tm_sec < SECSPERMIN) 1494 saved_seconds = 0; 1495 else if (yourtm.tm_year + TM_YEAR_BASE < EPOCH_YEAR) { 1496 /* 1497 ** We can't set tm_sec to 0, because that might push the 1498 ** time below the minimum representable time. 1499 ** Set tm_sec to 59 instead. 1500 ** This assumes that the minimum representable time is --- 313 unchanged lines hidden --- |