[sf-perl] localtime bug

Rich Morin rdm at cfcl.com
Wed Apr 12 16:33:32 PDT 2006


At 10:51 AM -0700 4/12/06, S A wrote:
> [samshey at amshey samshey]$ cat test
> #!/usr/local/bin/perl -w
> ...
> [samshey at amshey samshey]$ perl -v
> This is perl, v5.8.8 built for i686-linux-thread-multi
> ...

These are not guaranteed to use the same copy of perl.  Use:

> #!/usr/bin/env perl
>
> use strict;
> use warnings;

Running your code, I get the same results.  I think this may be
inconsistent handling of DST in the different routines.  File a
bug report...


> my $time_start = timelocal(40, 59, 03, 02, 03, 06); # 3:59:40

It's not a problem here, but putting leading zeros on numbers,
in Perl, indicates that they are in octal (base 8) format.  So,
using them on decimal numbers is not a good habit to get into.

-r
-- 
http://www.cfcl.com/rdm            Rich Morin
http://www.cfcl.com/rdm/resume     rdm at cfcl.com
http://www.cfcl.com/rdm/weblog     +1 650-873-7841

Technical editing and writing, programming, and web development


More information about the SanFrancisco-pm mailing list