diff options
author | wollman <wollman@FreeBSD.org> | 2001-06-05 20:13:28 +0000 |
---|---|---|
committer | wollman <wollman@FreeBSD.org> | 2001-06-05 20:13:28 +0000 |
commit | 47ad85ccaf42fc916877112e77428eabd4c675aa (patch) | |
tree | 2ca1430cecacd7893dce7f1df5236e7b84c3f716 /lib/libc | |
parent | 8c780c8d9a2997c3bb4f2f77173b0af33cefeb75 (diff) | |
download | FreeBSD-src-47ad85ccaf42fc916877112e77428eabd4c675aa.zip FreeBSD-src-47ad85ccaf42fc916877112e77428eabd4c675aa.tar.gz |
Don't mung the user's tm_sec field if we don't need to. (Belt-and-suspenders
version.)
PR: bin/27630
Submitted by: Arthur David Olson <ado@nci.nih.gov>
Obtained from: Timezone mailing-list <tz@elsie.nci.nih.gov>
MFC after: 1 month
Diffstat (limited to 'lib/libc')
-rw-r--r-- | lib/libc/stdtime/localtime.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/libc/stdtime/localtime.c b/lib/libc/stdtime/localtime.c index 92541c5..eaee232 100644 --- a/lib/libc/stdtime/localtime.c +++ b/lib/libc/stdtime/localtime.c @@ -1449,7 +1449,9 @@ int * const okayp; } if (increment_overflow(&yourtm.tm_year, -TM_YEAR_BASE)) return WRONG; - if (yourtm.tm_year + TM_YEAR_BASE < EPOCH_YEAR) { + if (yourtm.tm_sec >= 0 && yourtm.tm_sec < SECSPERMIN) + saved_seconds = 0; + else if (yourtm.tm_year + TM_YEAR_BASE < EPOCH_YEAR) { /* ** We can't set tm_sec to 0, because that might push the ** time below the minimum representable time. |