On Fri Mar 06 19:38:58 2015, MAURICE wrote:
Show quoted text> On Fri Mar 06 18:04:13 2015, STBEY wrote:
> > Mktime() is documented as not being very reliable ("USE AT YOUR OWN
> > RISK!"),
> > because it depends on the implementation on each machine and each
> > Perl
> > version,
> > which I can't do anything about.
> > So if it works for you, you are lucky, if it doesn't, you are out of
> > luck.
> > If you can find a workaround, the better for you.
> >
> > Sorry!
>
> I think the confusing thing is the docs suggest it's just a wrapper,
> and includes this note:
>
> 'A fatal "date out of range" error will occur if the given date cannot
> be expressed in terms of seconds since the epoch (this happens for
> instance when the date lies before the epoch, or if it is later than
> 19-Jan-2038 03:14:07 GMT on 32 bit Unix systems, or later than
> 06-Feb-2040 06:28:15 (local time) on a Macintosh with MacOS Classic).
> '
>
> Which kind of suggests to me that the 32-bitness has something to do
> with the limit -- but it doesn't. Same failure on 64-bit, since the
> limit check is hard-coded.
>
> Would you consider a patch if I worked on one?
Yes, the function Mktime() in my module is just a wrapper around whatever Perl/POSIX/C provide.
This is why the results are so unpredictable and why I can't do anything about it.
There is no code of mine whatsoever, I just pass the parameters on to the internal function and return its output - that's it.
I doubt that your patch will be able to fix that, and even if it does, it may not do so on other machines with other OS's, on which it might fail catastrophically.
Therefore I would rather not change anything in my code.
These functions are only for the not faint of heart!
Better alternatives are Date2Time() and Time2Date(), which are my own code - and they work.