From 47ad85ccaf42fc916877112e77428eabd4c675aa Mon Sep 17 00:00:00 2001 From: wollman Date: Tue, 5 Jun 2001 20:13:28 +0000 Subject: 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 Obtained from: Timezone mailing-list MFC after: 1 month --- lib/libc/stdtime/localtime.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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. -- cgit v1.1