I'd have to agree with Jake here. This is odd. When I run the
following snipper on my Mac I get:
$t1 = 0;
@c = gmtime($t1);
print "GMT: $t1 = @c \n";
@c = localtime($t1);
print "Local: $t1 = @c \n";
We see:
GMT: 0 = 0 0 7 1 0 4 5 0 1
Local: 0 = 0 0 0 1 0 4 5 0 1
(I'm in pacific time with daylight savings time so I am have a UTC of -7)
If I run that same code snippet on different linux boxes I get.
GMT: 0 = 0 0 0 1 0 70 4 0 0
Local: 0 = 0 0 16 31 11 69 3 364 0
This looks to be what a person would expect. It looks like the logic
in the gmtime and localtime are somewhat reversed. This requires
more investigation.
Chris Nandor, are you reading this? Is the MacPerl source available?
-Andrew
>Hi Folks,
>
>Can anyone tell me why the snippet below yields
>an hour value other than zero? I'm simply subtracting
>the hrs/min/sec value (in seconds) from the time which
>contains precisely that hrs/min/sec value.
>
>I'm running this from EDT zone and get these results:
>
>3070360208 = 8 50 17 17 3 101 2 106 1
>49808 = 8 50 17 1 0 4 5 0 1
>3070310400 = 0 0 4 17 3 101 2 106 1
>
>Why that hour value of 4 ???
>
>$t1 = time;
>@c = gmtime($t1); print "$t1 = @c \n";
>$t2 = $t1 % (24 * 3600);
>@c = gmtime($t2); print "$t2 = @c \n";
>$t3 = $t1 - $t2;
>@c = gmtime($t3); print "$t3 = @c \n";
>
>Regards,
>
>Jake Commander