public inbox for libc-hacker@sourceware.org
 help / color / mirror / Atom feed
From: Jakub Jelinek <jakub@redhat.com>
To: Ulrich Drepper <drepper@redhat.com>
Cc: Glibc hackers <libc-hacker@sources.redhat.com>
Subject: [PATCH] Fix mktime
Date: Fri, 05 Apr 2002 04:36:00 -0000	[thread overview]
Message-ID: <20020405143604.O32482@sunsite.ms.mff.cuni.cz> (raw)

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

             reply	other threads:[~2002-04-05 12:36 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-04-05  4:36 Jakub Jelinek [this message]
2002-04-05  8:45 ` Ulrich Drepper
2002-04-13  2:59 Jakub Jelinek
2002-04-14 23:27 ` Ulrich Drepper
2002-04-17  5:22 ` Thorsten Kukuk
2004-12-02 18:30 Jakub Jelinek
2004-12-02 22:18 ` Roland McGrath

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20020405143604.O32482@sunsite.ms.mff.cuni.cz \
    --to=jakub@redhat.com \
    --cc=drepper@redhat.com \
    --cc=libc-hacker@sources.redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).