X-Git-Url: http://erislabs.net/gitweb/?a=blobdiff_plain;ds=sidebyside;f=lib%2Fmktime.c;h=ded3295c6f3ca1b7f3772c6735420d3c1b467aaa;hb=a7cc0db9f5f6c63936c6914d4bb6448789774e5f;hp=b2d9e52e4bc60ec9b554f80221266e65a5af82d1;hpb=69d12657009b2d32c7901b5d45fb70341e5f14af;p=gnulib.git diff --git a/lib/mktime.c b/lib/mktime.c index b2d9e52e4..ded3295c6 100644 --- a/lib/mktime.c +++ b/lib/mktime.c @@ -1,7 +1,7 @@ /* Convert a `struct tm' to a time_t value. - Copyright (C) 1993-1999, 2002-2004, 2005 Free Software Foundation, Inc. + Copyright (C) 1993-1999, 2002-2005, 2006 Free Software Foundation, Inc. This file is part of the GNU C Library. - Contributed by Paul Eggert (eggert@twinsun.com). + Contributed by Paul Eggert . This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -215,10 +215,11 @@ guess_time_tm (long int year, long int yday, int hour, int min, int sec, /* Overflow occurred one way or another. Return the nearest result that is actually in range, except don't report a zero difference if the actual difference is nonzero, as that would cause a false - match. */ + match; and don't oscillate between two values, as that would + confuse the spring-forward gap detector. */ return (*t < TIME_T_MIDPOINT - ? TIME_T_MIN + (*t == TIME_T_MIN) - : TIME_T_MAX - (*t == TIME_T_MAX)); + ? (*t <= TIME_T_MIN + 1 ? *t + 1 : TIME_T_MIN) + : (TIME_T_MAX - 1 <= *t ? *t - 1 : TIME_T_MAX)); } /* Use CONVERT to convert *T to a broken down time in *TP.