mIRC Home    About    Download    Register    News    Help

Print Thread
wrong value of $asctime(z) (timezone) #221864 30/05/10 04:16 PM
Joined: Dec 2002
Posts: 17
V
voks Offline OP
Pikka bird
OP Offline
Pikka bird
V
Joined: Dec 2002
Posts: 17
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.


using mirc 6.35 on WinXP Home SP3 and Windows 7
Re: wrong value of $asctime(z) (timezone) [Re: voks] #221866 30/05/10 04:58 PM
Joined: Oct 2005
Posts: 1,741
G
genius_at_work Offline
Hoopy frood
Offline
Hoopy frood
G
Joined: Oct 2005
Posts: 1,741
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

Re: wrong value of $asctime(z) (timezone) [Re: genius_at_work] #221869 30/05/10 06:07 PM
Joined: Dec 2002
Posts: 3,138
C
Collective Offline
Hoopy frood
Offline
Hoopy frood
C
Joined: Dec 2002
Posts: 3,138
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.

Re: wrong value of $asctime(z) (timezone) [Re: Collective] #222046 04/06/10 11:16 AM
Joined: Dec 2002
Posts: 4,484
Khaled Offline
Hoopy frood
Offline
Hoopy frood
Joined: Dec 2002
Posts: 4,484
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.

Re: wrong value of $asctime(z) (timezone) [Re: Khaled] #223908 03/08/10 08:09 AM
Joined: Nov 2003
Posts: 18
Zyxak Offline
Pikka bird
Offline
Pikka bird
Joined: Nov 2003
Posts: 18
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


=Z=
Re: wrong value of $asctime(z) (timezone) [Re: Zyxak] #223910 03/08/10 08:27 AM
Joined: Dec 2002
Posts: 3,138
C
Collective Offline
Hoopy frood
Offline
Hoopy frood
C
Joined: Dec 2002
Posts: 3,138
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).

Re: wrong value of $asctime(z) (timezone) [Re: Collective] #223912 03/08/10 09:03 AM
Joined: Nov 2003
Posts: 18
Zyxak Offline
Pikka bird
Offline
Pikka bird
Joined: Nov 2003
Posts: 18
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


=Z=
Re: wrong value of $asctime(z) (timezone) [Re: Zyxak] #223916 03/08/10 09:23 AM
Joined: Dec 2002
Posts: 3,138
C
Collective Offline
Hoopy frood
Offline
Hoopy frood
C
Joined: Dec 2002
Posts: 3,138
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.

Re: wrong value of $asctime(z) (timezone) [Re: Collective] #223920 03/08/10 09:52 AM
Joined: Nov 2003
Posts: 18
Zyxak Offline
Pikka bird
Offline
Pikka bird
Joined: Nov 2003
Posts: 18
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.


=Z=
Re: wrong value of $asctime(z) (timezone) [Re: Zyxak] #223923 03/08/10 10:58 AM
Joined: Dec 2002
Posts: 4,484
Khaled Offline
Hoopy frood
Offline
Hoopy frood
Joined: Dec 2002
Posts: 4,484
Thanks, this has been fixed for the next version.

Re: wrong value of $asctime(z) (timezone) [Re: Khaled] #223996 04/08/10 05:10 AM
Joined: Nov 2003
Posts: 18
Zyxak Offline
Pikka bird
Offline
Pikka bird
Joined: Nov 2003
Posts: 18
Originally Posted By: Khaled
Thanks, this has been fixed for the next version.

Thanx for confirming that Khaled.


=Z=