SPUG: localtime() returning hour in wrong range?

Tim Maher tim at consultix-inc.com
Sun Apr 8 14:14:32 PDT 2007


On Sun, Apr 08, 2007 at 01:44:43PM -0700, Aaron W. West wrote:
> Umm, Erroneous belief that localtime hours are 0..23? Huh?

I was discussing how the conflicting statements in the documentation
might lead one to conclude that hours are coded in a 1-based series
(1-24), requiring adjustment to produce the actual hours (0-23). Based
on that reasoning, the output of the test program I provided seemed to
be incorrect.

Based on new input (thanks Erik and John), I now see that localtime
hours are indeed 0..23, and in need of no conversion to produce hours
in military time. My apologies for any confusion!

-Tim
*-------------------------------------------------------------------*
|  Tim Maher, PhD  (206) 781-UNIX   http://www.consultix-inc.com    |
|  tim at ( Consultix-Inc, TeachMePerl, or TeachMeUnix ) dot Com    |
| CLASSES: 4/23: Perl+CGI; 5/7: Basic UNIX/Linux; 5/11: Perl Hashes |
*-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-*
| >> My "Minimal Perl" is an Amazon Best Seller; 5 star rating! <<  |
| # Download chapters, read reviews, and order at MinimalPerl.com # |
*-------------------------------------------------------------------*


More information about the spug-list mailing list