This is the mail archive of the libc-hacker@sources.redhat.com mailing list for the glibc project.

Note that libc-hacker is a closed list. You may look at the archives of this list, but subscription and posting are not open.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] Fix mktime


Hi!

ISO C99ism which older GCCs (< 3.0, or < 3.1?) don't cope with:

2002-04-05  Jakub Jelinek  <jakub@redhat.com>

	* time/mktime.c (__mktime_internal): Move check for year < 70 below
	all variable declarations.

--- libc/time/mktime.c.jj	Fri Apr  5 14:34:22 2002
+++ libc/time/mktime.c	Fri Apr  5 14:36:38 2002
@@ -246,10 +246,6 @@ __mktime_internal (struct tm *tp,
   int mon_years = mon / 12 - negative_mon_remainder;
   int year = year_requested + mon_years;
 
-  /* Only years after 1970 are defined.  */
-  if (year < 70)
-    return -1;
-
    /* The other values need not be in range:
      the remaining code handles minor overflows correctly,
      assuming int and time_t arithmetic wraps around.
@@ -271,6 +267,10 @@ __mktime_internal (struct tm *tp,
     sec = 59;
 #endif
 
+  /* Only years after 1970 are defined.  */
+  if (year < 70)
+    return -1;
+
   /* Invert CONVERT by probing.  First assume the same offset as last time.
      Then repeatedly use the error to improve the guess.  */
 

	Jakub


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]