This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.


For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message.

Worldtime1.3.tcl working, again.

Support & discussion of released scripts, and announcements of new releases.
Post Reply
K
Koo
Voice
Posts: 37
Joined: Fri Apr 02, 2010 7:43 pm

Re: speechles' worldtime

Post by Koo »

hm2k wrote:Woops, my mistake, I mean this page:
No problem. Everyone makes mistake, myself included. :P
Nice script. Does it able to display the time for any city in the world? :D

Anyway, could you make the script displays the timezone for the place as well? Also, how to change the script's trigger to "!"? I'm looking for a script like that. Thanks in advance.
User avatar
hm2k
Halfop
Posts: 57
Joined: Mon Sep 11, 2006 7:27 am
Location: UK

Post by hm2k »

Yes, it does all the major cities and many other places across the world.

To change the trigger, just change this line:

Code: Select all

set tz(cmd) ".tz"; #public command trigger
to

Code: Select all

set tz(cmd) "!tz"; #public command trigger
That's all! :)
K
Koo
Voice
Posts: 37
Joined: Fri Apr 02, 2010 7:43 pm

Post by Koo »

hm2k wrote:To change the trigger, just change this line:

Code: Select all

set tz(cmd) ".tz"; #public command trigger
to

Code: Select all

set tz(cmd) "!tz"; #public command trigger
That's all! :)
Done. Thanks hm2k.


EDIT:

Code: Select all

<!Koo>!tz singapore
<AngeL> The time for Asia/Singapore timezone is 11:22:52 at Tue, Apr 20 2010.
The actual time for Singapore at the moment I typed that was 3:22PM or 15:32 and not 11:22. As you can see, I made some modification to your script but the same problem happened even when I'm using the original script. How to fix this?

Also, it would be better if the script could display timezone as well. For example:

Code: Select all

<!Koo>!tz singapore
<AngeL> The time for Asia/Singapore timezone is 11:22:52 at Tue, Apr 20 2010 on GMT+8.
Or something like that.

Thanks. :D
User avatar
hm2k
Halfop
Posts: 57
Joined: Mon Sep 11, 2006 7:27 am
Location: UK

Post by hm2k »

This is what I see:

Code: Select all

[09:38:31 am] > .tz singapore
[09:38:31 am] <Bot> The time for the Asia/Singapore timezone is Tue Apr 20 17:38:32 2010 GMT+8
[09:38:33 am] > .tz GMT
[09:38:33 am] <Bot> The time for the GMT timezone is Tue Apr 20 09:38:35 2010 GMT
The time in Singapore is 8 hours ahead, so that would appear to be correct.

Also, as you can see, I have updated the script to include the timezone offset.

Latest version can be found here: http://hm2k.googlecode.com/svn/trunk/co ... ldtime.tcl
K
Koo
Voice
Posts: 37
Joined: Fri Apr 02, 2010 7:43 pm

Post by Koo »

hm2k wrote:Latest version can be found here: http://hm2k.googlecode.com/svn/trunk/co ... ldtime.tcl
Awesome. However, I still got the "4 hours off" error just like I mentioned on my post before. What have I done wrong and what should I do to fix that? :(
User avatar
hm2k
Halfop
Posts: 57
Joined: Mon Sep 11, 2006 7:27 am
Location: UK

Post by hm2k »

So, I'm not sure why you would be seeing this; however fortunately another user had a similar problem, so I wrote a manual offset feature:

Change:

Code: Select all

set tz(offset) 0; #seconds, eg: 3600 for plus 1 hour or -3600 for minus
To

Code: Select all

set tz(offset) -14400; #seconds, eg: 3600 for plus 1 hour or -3600 for minus
-14400 is minus 4 hours.

Let me know how that works out.
K
Koo
Voice
Posts: 37
Joined: Fri Apr 02, 2010 7:43 pm

Post by Koo »

hm2k wrote:So, I'm not sure why you would be seeing this; however fortunately another user had a similar problem, so I wrote a manual offset feature:

Change:

Code: Select all

set tz(offset) 0; #seconds, eg: 3600 for plus 1 hour or -3600 for minus
To

Code: Select all

set tz(offset) -14400; #seconds, eg: 3600 for plus 1 hour or -3600 for minus
-14400 is minus 4 hours.

Let me know how that works out.
I changed that to +14400 instead and it works. Thanks hm2k. :D
User avatar
hm2k
Halfop
Posts: 57
Joined: Mon Sep 11, 2006 7:27 am
Location: UK

Post by hm2k »

Jolly good, I knew you'd figure it out :)
K
Koo
Voice
Posts: 37
Joined: Fri Apr 02, 2010 7:43 pm

Post by Koo »

I have a new problem. I didn't notice this problem earlier until one of my friend on the channel said that the time for the city that has Daylight Saving was off by 1 hour. How to fix that? :o
User avatar
hm2k
Halfop
Posts: 57
Joined: Mon Sep 11, 2006 7:27 am
Location: UK

Post by hm2k »

Unfortunately my crystal ball isn't working and I don't know which city you are talking about. :p

How about you give me a bit more info to go on... ;)
K
Koo
Voice
Posts: 37
Joined: Fri Apr 02, 2010 7:43 pm

Post by Koo »

hm2k wrote:Unfortunately my crystal ball isn't working and I don't know which city you are talking about. :p

How about you give me a bit more info to go on... ;)
Oh sorry, I should give an example for it earlier. :P

It's like this:
<Me>!tz berlin
<Bot> The time for the Europe/Berlin timezone is 12:16:14 on Fri, Apr 23 2010 at GMT+1.
It should be 13:16:14 at that moment. The same thing happened to other city (which I don't remember) that has Daylight Saving.
User avatar
hm2k
Halfop
Posts: 57
Joined: Mon Sep 11, 2006 7:27 am
Location: UK

Post by hm2k »

I can't reproduce this bug...

[10:17:24 pm] > .tz berlin
[10:17:24 pm] <Bot> The time for the Europe/Berlin timezone is Mon Apr 26 23:17:25 2010 GMT+1
[10:17:27 pm] > .tz gmt
[10:17:28 pm] <Bot> The time for the GMT-0 timezone is Mon Apr 26 22:17:29 2010 GMT

It is GMT+1 hour as expected.
n
nml375
Revered One
Posts: 2860
Joined: Fri Aug 04, 2006 2:09 pm

Post by nml375 »

hm2k,
During DST (Daylight Savings Time), the offset is advanced one hour. For Berlin, this means we've got CEST (GMT+2) instead of CET (GMT+1) from March 28th 2010 through October 31st 2010.

Rather than looking for the last non-isdst rule in the list, you should look for the most recent one that does not exceed the current date (in UTC).
NML_375
User avatar
hm2k
Halfop
Posts: 57
Joined: Mon Sep 11, 2006 7:27 am
Location: UK

Post by hm2k »

Unfortunately this seems to be a limitation of the tz database itself rather than my script...
Time in Germany, which is represented by Europe/Berlin is not correct for the time span after 1945 when the Trizone did not follow Berlin's switch to DST.
-- From http://en.wikipedia.org/wiki/Tz_database

However, I have divulged further...

[11:04:04 am] > .tz London
[11:04:05 am] <Bot> The time for the Europe/London timezone is Tue Apr 27 11:04:05 2010 GMT

In London we're currently in BST, which is one hour ahead of GMT/UTC...

[11:04:14 am] > .tz UTC
[11:04:15 am] <Bot> The time for the UTC timezone is Tue Apr 27 11:04:15 2010 GMT

They are essentially showing the same time, which is wrong...

I am currently considering my options... Any input will be useful.
User avatar
hm2k
Halfop
Posts: 57
Joined: Mon Sep 11, 2006 7:27 am
Location: UK

Post by hm2k »

Ok, I fixed it all; I decided that the timezone database was unreliable and not portable; so now we use google to get our timezone data.

I also fixed a regex; which was collecting the wrong data to convert date to time; this made things about an hour out sometimes.

Download latest here:

http://hm2k.googlecode.com/svn-history/ ... ldtime.tcl

For example:
[04:13:57 pm] > .tz london
[04:13:58 pm] <Bot> The time in Westminster, London, UK is Tue Apr 27 04:13:58 PM 2010 (GMT+1)
[04:13:58 pm] > .tz berlin
[04:13:59 pm] <Bot> The time in Berlin, Germany is Tue Apr 27 05:13:59 PM 2010 (GMT+2)
Good luck!
Post Reply