Mail Archives: djgpp/2001/03/15/08:46:03
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 -