[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

[MacPerl] mktime not working?



Greetings!

I have recently started developing for the WWW using Perl. I have been
using MacPerl to test locally.

In the last couple of days, it seems like POSIX stopped working.
Here's a snippet of code that works on a UNIX machine, but doesn't
with MacPerl:

*** BEGIN CODE ***

use POSIX;

$CalMonth = 8;
$CalYear = 1998;

($sec,$min,$hour,$mday,$month,$year,$wday,$yday,$isdst) = localtime();
print "$sec, $min, $hour, $mday, $month, $year, $wday, $yday, $isdst\n";
($sec,$min,$hour,$mday,$month,$year,$wday,$yday,$isdst) =
localtime(mktime (0, 0, 12, 1, $CalMonth - 1, $CalYear - 1900, '' , ''
, -1));
print "$sec, $min, $hour, $mday, $month, $year, $wday, $yday, $isdst\n";


*** END CODE ***

The first print works as expected, printing out the values for the
current time. The second does not (it's supposed to print the values
for 1 August 1998). Instead, it prints the values for 1 Jan 1904.

Does anyone have any idea what's causing this? It's really a pain.
I've tried reinstalling MacPerl 5.20r4, but that didn't change anything.

Thanks!

- Jonathan

===
+----------------------------------->
+ Jonathan Hurshman
+ http://home.att.net/~J-M.Hurshman/
+----------------------------------->
_________________________________________________________
DO YOU YAHOO!?
Get your free @yahoo.com address at http://mail.yahoo.com


***** Want to unsubscribe from this list?
***** Send mail with body "unsubscribe" to mac-perl-request@iis.ee.ethz.ch