bug-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Bug-gnulib] getdate.y question


From: Derek Robert Price
Subject: Re: [Bug-gnulib] getdate.y question
Date: Wed, 12 May 2004 13:53:42 -0400
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.6) Gecko/20040413

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Conrad T. Pino wrote:

>Hi Derek,
>
>>From: Derek Robert Price
>>
>>Paul Eggert wrote:
>>
>>>I hope nobody is relying on getdate's current mktime-like behavior.
>>>On the other hand, fixing getdate to reject invalid dates like "Apr
>>>31" would be a bit of work, due to some tricky interactions between
>>>mktime, overflow checking, and time zones.
>>
>>Anyone with more experience with time issues than I have time (no pun
>>intended) to take a shot at fixing mktime.c?
>
>
>I haven't been following this thread closely.  I do have experience
>implementing Julian Day Number algorigthms in C & Java:
>
>   http://www.hermetic.ch/cal_stud/jdn.htm
>
>Where should I look to find out what the issue is?


    http://mail.gnu.org/archive/html/bug-cvs/2004-04/msg00333.html

Basically, getdate() used to reject invalid dates & times like, "Jan.
40th, 2004".  To fix a bug & reuse code, the GNULIB team decided to
have getdate.y use the mktime() function to convert a broken down time
structure back into a time_t/seconds since the epoch.  Unfortunately,
mktime converts overflow in certain fields to valid dates and maybe
times, in the case of this example, it will yield Feb. 9th.

I'm not sure whether the correct fix would be some sort of overflow
checking in getdate.y (though I worry that this solution would end up
duplicating much of the same code from mktime() that we wish to avoid
duplicating), or the implementation of some sort of "overflow
converted" return value from mktime(), or perhaps even a new argument
to mktime() to force strict overflow checks (more likely a new
mktime_strict() function which could wrap and share an internal
function with mktime(), to prevent changing the mktime() interface),

Cheers,

Derek

- --
                *8^)

Email: derek@ximbiot.com

Get CVS support at <http://ximbiot.com>!
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFAomSlLD1OTBfyMaQRAnsEAKCmGIVUrYplTd8ae1QuFAsv2bsUOACfRwGI
G4rq/yR4MeaJCouos62o+Uo=
=EOcO
-----END PGP SIGNATURE-----





reply via email to

[Prev in Thread] Current Thread [Next in Thread]