mIRC Home    About    Download    Register    News    Help

Print Thread
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
Joined: Oct 2005
Posts: 1,741
G
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

Joined: Dec 2002
Posts: 3,138
C
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.

Joined: Dec 2002
Posts: 5,411
Hoopy frood
Offline
Hoopy frood
Joined: Dec 2002
Posts: 5,411
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.

Joined: Nov 2003
Posts: 18
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=
Joined: Dec 2002
Posts: 3,138
C
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).

Joined: Nov 2003
Posts: 18
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=
Joined: Dec 2002
Posts: 3,138
C
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.

Joined: Nov 2003
Posts: 18
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=
Joined: Dec 2002
Posts: 5,411
Hoopy frood
Offline
Hoopy frood
Joined: Dec 2002
Posts: 5,411
Thanks, this has been fixed for the next version.

Joined: Nov 2003
Posts: 18
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=

Link Copied to Clipboard