mIRC Homepage

wrong value of $asctime(z) (timezone)

Posted By: voks

wrong value of $asctime(z) (timezone) - 30/05/10 04:16 PM

I'm in Germany here, and $asctime(z) returns +1, but it should be +2, I think.
Reason: Germany has UTC/GMT +2 currently because of daylight saving time.

Tested with mIRC 6.35 and 7.04 beta on WinXP SP3, automatic daylight saving time change enabled.
Posted By: genius_at_work

Re: wrong value of $asctime(z) (timezone) - 30/05/10 04:58 PM

Your timezone doesn't change during daylight savings. You just have to add/subtract time from the normal offset. This is due to the fact that the offset doesn't necessarily have to be 1 hour (it could be 30 minutes, or 2 hours, or any other number in theory). mIRC provides the $daylight identifier so that you can make the necessary calculations.

-genius_at_work
Posted By: Collective

Re: wrong value of $asctime(z) (timezone) - 30/05/10 06:07 PM

Quote:
Your timezone doesn't change during daylight savings.

The rules that tell me what the time is in my timezone change, so the offset returned by $asctime (which is explicitly an offset from GMT) should change too. Wikipedia agrees with me on this.

In my opinion it is pretty obvious that if $asctime returns "20:00:00 +0100 GMT" and doing the math does not give me the current time in GMT then it is wrong.

$gmt is also faulty as it does not return GMT at all, but rather GMT + $daylight.

Quote:
This is due to the fact that the offset doesn't necessarily have to be 1 hour (it could be 30 minutes, or 2 hours, or any other number in theory)

That's not relevant - your offset can still be a multiple of 30 minutes regardless of your current daylight saving offset.
Posted By: Khaled

Re: wrong value of $asctime(z) (timezone) - 04/06/10 11:16 AM

This has been reported a few times in the past but I chose not to fix it since doing so would break all scripts that work around this issue. However, I have just looked through my code and found that the way the timezone and daylight offsets are applied are not consistent across time-related identifiers and other time routines (they were all implemented at different times, as features were added). So I have decided to fix this issue once and for all. The next version will apply the correct timezone and daylight offsets across all identifiers and routines. This will fix the $asctime(z) timezone discrepancy as well as the $gmt bug.
Posted By: Zyxak

Re: wrong value of $asctime(z) (timezone) - 03/08/10 08:09 AM

Originally Posted By: Khaled
So I have decided to fix this issue once and for all. The next version will apply the correct timezone and daylight offsets across all identifiers and routines. This will fix the $asctime(z) timezone discrepancy as well as the $gmt bug.


I'm now using 7.1. Are these bugs supposed to be fixed in this version? From what I can see, they're not.

Although my PC timezone is set to +10:00 I get the following...

$asctime(z) returns +11
$timezone returns -39600
$calc($timezone / 3600) returns -11
$calc(($ctime - $gmt) / 3600) returns 11
Posted By: Collective

Re: wrong value of $asctime(z) (timezone) - 03/08/10 08:27 AM

Originally Posted By: Zyxak
Although my PC timezone is set to +10:00 I get the following...

$asctime(z) returns +11
$timezone returns -39600
$calc($timezone / 3600) returns -11
$calc(($ctime - $gmt) / 3600) returns 11

Are you saying your computer is set to not observe DST? According to your location your current offset from GMT should be +11 (AEDT), not +10 (AEST).
Posted By: Zyxak

Re: wrong value of $asctime(z) (timezone) - 03/08/10 09:03 AM

Originally Posted By: Collective
Originally Posted By: Zyxak
Although my PC timezone is set to +10:00 I get the following...

$asctime(z) returns +11
$timezone returns -39600
$calc($timezone / 3600) returns -11
$calc(($ctime - $gmt) / 3600) returns 11

Are you saying your computer is set to not observe DST? According to your location your current offset from GMT should be +11 (AEDT), not +10 (AEST).


I'm in the Southern Hemisphere. It's winter here atm ie AEST not AEDT.

It's no wonder we end up with GMT and timezone bugs when people can't even grasp when various parts of the planet are in either Summer or Winter.

For more info see http://www.timeanddate.com/worldclock/city.html?n=152
Posted By: Collective

Re: wrong value of $asctime(z) (timezone) - 03/08/10 09:23 AM

Well, that was embarrassing. I didn't even link "DST" to "Summer" in my head.

Just to give a couple more details if they're needed: $daylight returns 0 when this bug occurs, and disabling Windows' automatic DST adjustment setting seems to fix it.

Sorry about that.
Posted By: Zyxak

Re: wrong value of $asctime(z) (timezone) - 03/08/10 09:52 AM

Originally Posted By: Collective
Just to give a couple more details if they're needed: $daylight returns 0 when this bug occurs, and disabling Windows' automatic DST adjustment setting seems to fix it.

It's showing 0 for me too but I would expect that at the moment.

$calc(($ctime - $gmt) / 3600)
returns 11
$calc(($ctime - $gmt + $daylight) / 3600) returns 11

Originally Posted By: Collective
Sorry about that.

Me too, I probably jumped on you a bit hard.
Posted By: Khaled

Re: wrong value of $asctime(z) (timezone) - 03/08/10 10:58 AM

Thanks, this has been fixed for the next version.
Posted By: Zyxak

Re: wrong value of $asctime(z) (timezone) - 04/08/10 05:10 AM

Originally Posted By: Khaled
Thanks, this has been fixed for the next version.

Thanx for confirming that Khaled.
© 2020 mIRC Discussion Forums