On Thu, Jun 14, 2012 at 04:21:14PM +0200, Philippe Bruhat (BooK) wrote:
> On Thu, Jun 14, 2012 at 02:05:54PM +0100, Paul LeoNerd Evans wrote:
> > I am hesitant to upload this to CPAN, because -suuuurely- something like
> > it already exists. I can't seem to find it though.
> > 
> > -----
> > Time::mkgmtime(3)     User Contributed Perl Documentation    
> > Time::mkgmtime(3)
> > 
> > 
> > 
> > NAME
> >        "Time::mkgmtime" - a UTC version of "mktime()"
> > 
> > SYNOPSIS
> >         use Time::mkgmtime qw( mkgmtime );
> > 
> >         my $epoch = mkgmtime 0, 0, 0, 14, 6-1, 2012-1900;
> > 
> >         print "2012-06-14 00:00:00 UTC happened at ",
> >            scalar localtime($epoch), " localtime\n";
> 
> Isn't it exactly what Time::Local's timegm and timelocal do?

Which is exactly why I further explained the differences.

Time::Local complains about out-of-range values. It cannot do 25th hour
or -3rd day or whatever. Time::mkgmtime specifically allows these, the
same way POSIX::mktime() does.

-- 
Paul "LeoNerd" Evans

leon...@leonerd.org.uk
ICQ# 4135350       |  Registered Linux# 179460
http://www.leonerd.org.uk/

Attachment: signature.asc
Description: Digital signature

Reply via email to