[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: mktime() and invalid dates
From: |
Jean-Philippe Guérard |
Subject: |
Re: mktime() and invalid dates |
Date: |
Mon, 26 Apr 2010 01:02:48 +0200 |
User-agent: |
Mutt/1.5.20 (2009-06-14) |
Le 2010-04-25 23:03:00 +0300, Aharon Robbins écrivait :
>
> Fixed in my development version (which might not yet be in CVS):
>
> $ ./gawk 'BEGIN{ print mktime("2010 03 32 25 61 61")
> > print mktime("2010 04 02 02 02 01")
> > }'
> -1
> 1270162921
Is it a good idea to fix this? For me, it's more a feature than a bug. It can
be used to implement
simple date calculation (e.g. 'strftime( "%c", mktime(YEAR " " MONTH " " DAY+60
" " TIME ))' to get
the date in 60 days, without worrying about end of months, year end and leap
year).
It might be better to have this more strict check as an option.
Regards,
Jean-Philippe
--
Jean-Philippe Guérard
http://tigreraye.org