Do only one call to GetVersionEx in the common case.
[pspp] / lib / mktime.c
index a91fb20e68cf446a15e186df81853ca840cc80c9..a42c771542023520f20b6a984e35d49f17dafc83 100644 (file)
@@ -1,5 +1,5 @@
 /* Convert a `struct tm' to a time_t value.
-   Copyright (C) 1993-1999, 2002-2005, 2006, 2007 Free Software Foundation, Inc.
+   Copyright (C) 1993-1999, 2002-2007, 2009 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Paul Eggert <eggert@twinsun.com>.
 
@@ -165,8 +165,11 @@ ydhms_diff (long int year1, long int yday1, int hour1, int min1, int sec1,
            int year0, int yday0, int hour0, int min0, int sec0)
 {
   verify (C99_integer_division, -1 / 2 == 0);
+#if 0 /* This assertion fails on 32-bit systems with 64-bit time_t, such as
+         NetBSD 5 on i386.  */
   verify (long_int_year_and_yday_are_wide_enough,
          INT_MAX <= LONG_MAX / 2 || TIME_T_MAX <= UINT_MAX);
+#endif
 
   /* Compute intervening leap days correctly even if year is negative.
      Take care to avoid integer overflow here.  */
@@ -290,7 +293,9 @@ __mktime_internal (struct tm *tp,
   int mday = tp->tm_mday;
   int mon = tp->tm_mon;
   int year_requested = tp->tm_year;
-  int isdst = tp->tm_isdst;
+  /* Normalize the value.  */
+  int isdst = ((tp->tm_isdst >> (8 * sizeof (tp->tm_isdst) - 1))
+              | (tp->tm_isdst != 0));
 
   /* 1 if the previous probe was DST.  */
   int dst2;