www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2001/03/15/08:46:03

Date: Thu, 15 Mar 2001 15:42:02 +0200 (IST)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
X-Sender: eliz AT is
To: Rafael García <rafael AT geninfor DOT com>
cc: djgpp AT delorie DOT com
Subject: RE: mktime(01/01/70;00:00:XX)
In-Reply-To: <3ab0b0d2$1@filemon.telecable.es>
Message-ID: <Pine.SUN.3.91.1010315153743.8433A-100000@is>
MIME-Version: 1.0
Reply-To: djgpp AT delorie DOT com
Errors-To: nobody AT delorie DOT com
X-Mailing-List: djgpp AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com

On Thu, 15 Mar 2001, Rafael Garc=EDa wrote:

> This should print 0 but it gives -1. And it fails with any second, until
> minute 1.
>=20
> > Also, what version of DJGPP do you have?  The time routines in v2.03
> > (djdev203.zip from the usual DJGPP sites) were enhanced to solve some
> > of the problems you are describing.
>=20
> YES! Thank you.
> I have tried with a newer package and it is OK.

The older library was known to have bugs near 1970 (which is called ``the=
=20
epoch'').

> But I have tried also with Borland C 3.1 (the compiler I was using
> previously) and it shows strange numbers too.
>=20
> And... Linux... it gives strange numbers for 01/01/70 too. I don't
> understand.

It is tricky to get the dates near the beginning of the epoch right.  The=
=20
problem is that, except for people who live in GMT time zone, 01/01/1970=20
could be slightly before the epoch, which is relative to GMT, due to the=20
time-zone offset.  There are quite a few libraries out there which get it=
=20
wrong.

> I'm confused about using this function. I don't plan to use it for past
> dates, but I don't know if I can trust this technique...

I think you can trust it as long as you don't come too close (within a=20
day or so) of 01/01/1970.  16-bit DOS libraries might also have problems=20
before 1980, because that's the DOS point of reference for times.

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019