L
Leendert Bottelberghs
Hi there,
I want to calculate the time zone offset (as an integer), and I don't want
to depend on other modules.
I want to verify if the following code is correct:
<code>
my @lctime = localtime();
my @gmtime = gmtime();
# index 2 represent the hours
# index 8 represent isdst (daylight saving time boolean (0/1))
$tzoffset = (($lctime[2] - $lctime[8])-($gmtime[2] - $gmtime[8]))%24);
</code>
I figured that if DST is applied locally, the clock is one hour ahead of
"normal" GMT (which hasn't DST applied), so this hour has to be deducted
from the time difference. If the GMT has DST set on, this hour has to be
added to the time difference, hence the double deduction.
Can anyone tell me if my my assumptions are correct?
TIA,
-leendert bottelberghs
I want to calculate the time zone offset (as an integer), and I don't want
to depend on other modules.
I want to verify if the following code is correct:
<code>
my @lctime = localtime();
my @gmtime = gmtime();
# index 2 represent the hours
# index 8 represent isdst (daylight saving time boolean (0/1))
$tzoffset = (($lctime[2] - $lctime[8])-($gmtime[2] - $gmtime[8]))%24);
</code>
I figured that if DST is applied locally, the clock is one hour ahead of
"normal" GMT (which hasn't DST applied), so this hour has to be deducted
from the time difference. If the GMT has DST set on, this hour has to be
added to the time difference, hence the double deduction.
Can anyone tell me if my my assumptions are correct?
TIA,
-leendert bottelberghs