mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Jul 2005
Posts: 5
G
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
G
Joined: Jul 2005
Posts: 5
I was writing a small script to get the time from a timeserver when I noticed that it returned an hour less than it should, then I found that $calc( $ctime - $gmt ) = 3600 instead of 7200. I'm in GMT+1 timezone, and 'summer time' (daylight savings time) is active so it's actually GMT+2, but $gmt returns $ctime-3600 instead of the correct GMT time.

mIRC version: 6.16
Windows version: Windows XP with SP1

EDIT: I did a small test and windows functions GetLocalTime and GetSystemTime both return the correct time values (GMT+2 Local, and GMT+0 System)

Last edited by GiGaHeRz; 27/07/05 12:08 AM.
Joined: Oct 2004
Posts: 8,330
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
Testing here (I'm EST):

//echo -a GMT $+ $calc(($ctime - $gmt) / 3600)
GMT-5

//echo -a GMT $+ $calc(($ctime - $gmt + $daylight) / 3600)
GMT-4

As you can see, $gmt doesn't include DST, so you have to add it in if you want it.


Invision Support
#Invision on irc.irchighway.net
Joined: Jul 2005
Posts: 5
G
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
G
Joined: Jul 2005
Posts: 5
That's why I say it's a bug. Local Time = GMT + zone offset + DST. When you use $gmt you get local time-zone offset but it can't be called GMT because GMT doesn't include any DST offset. It's just wrong that a timeserver says GMT=0:41 and mirc says GMT=1:41, it's not gmt but GMT+DST. I can live with this but I was just noting the bug.

EDIT: A few spell corrections.

Last edited by GiGaHeRz; 27/07/05 12:47 AM.
Joined: Oct 2004
Posts: 8,330
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
Ok, I see what you mean.


Invision Support
#Invision on irc.irchighway.net
Joined: Jul 2003
Posts: 14
B
Pikka bird
Offline
Pikka bird
B
Joined: Jul 2003
Posts: 14
I reported this same bug back when we were on version 5.91. I don't think it will be fixed. Her are the two aliases I use for returning true GMT, now officially called UTC (Coordinated Universal Time), and the true timezone offset with correct numeric sign.

alias utc return $calc($gmt - $daylight)

alias utcoffset return $calc($daylight - $timezone)

If by some chance it would be fixed in the next version, I suggest deprecating $gmt and $timezone since many people have probably created their own work-arounds.


Link Copied to Clipboard