| View previous topic :: View next topic |
| Author |
Message |
Koo Voice
Joined: 02 Apr 2010 Posts: 37
|
Posted: Mon Apr 19, 2010 3:30 pm Post subject: Re: speechles' worldtime |
|
|
| hm2k wrote: | | Woops, my mistake, I mean this page: |
No problem. Everyone makes mistake, myself included.
| hm2k wrote: | http://www.hm2k.com/posts/worldtime-tcl  |
Nice script. Does it able to display the time for any city in the world?
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. |
|
| Back to top |
|
 |
hm2k Halfop

Joined: 11 Sep 2006 Posts: 57 Location: UK
|
Posted: Mon Apr 19, 2010 4:52 pm Post subject: |
|
|
Yes, it does all the major cities and many other places across the world.
To change the trigger, just change this line:
| Code: | | set tz(cmd) ".tz"; #public command trigger |
to
| Code: | | set tz(cmd) "!tz"; #public command trigger |
That's all!  |
|
| Back to top |
|
 |
Koo Voice
Joined: 02 Apr 2010 Posts: 37
|
Posted: Tue Apr 20, 2010 3:32 am Post subject: |
|
|
| hm2k wrote: | To change the trigger, just change this line:
| Code: | | set tz(cmd) ".tz"; #public command trigger |
to
| Code: | | set tz(cmd) "!tz"; #public command trigger |
That's all!  |
Done. Thanks hm2k.
EDIT:
| Code: | <!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: | <!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.  |
|
| Back to top |
|
 |
hm2k Halfop

Joined: 11 Sep 2006 Posts: 57 Location: UK
|
Posted: Tue Apr 20, 2010 4:46 am Post subject: |
|
|
This is what I see:
| Code: | [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/code/tcl/worldtime.tcl |
|
| Back to top |
|
 |
Koo Voice
Joined: 02 Apr 2010 Posts: 37
|
Posted: Tue Apr 20, 2010 5:51 am Post subject: |
|
|
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?  |
|
| Back to top |
|
 |
hm2k Halfop

Joined: 11 Sep 2006 Posts: 57 Location: UK
|
Posted: Tue Apr 20, 2010 5:59 am Post subject: |
|
|
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: | set tz(offset) 0; #seconds, eg: 3600 for plus 1 hour or -3600 for minus
|
To
| Code: | 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. |
|
| Back to top |
|
 |
Koo Voice
Joined: 02 Apr 2010 Posts: 37
|
Posted: Tue Apr 20, 2010 1:46 pm Post subject: |
|
|
| 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: | set tz(offset) 0; #seconds, eg: 3600 for plus 1 hour or -3600 for minus
|
To
| Code: | 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.  |
|
| Back to top |
|
 |
hm2k Halfop

Joined: 11 Sep 2006 Posts: 57 Location: UK
|
Posted: Wed Apr 21, 2010 4:36 am Post subject: |
|
|
Jolly good, I knew you'd figure it out  |
|
| Back to top |
|
 |
Koo Voice
Joined: 02 Apr 2010 Posts: 37
|
Posted: Fri Apr 23, 2010 4:47 am Post subject: |
|
|
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?  |
|
| Back to top |
|
 |
hm2k Halfop

Joined: 11 Sep 2006 Posts: 57 Location: UK
|
Posted: Fri Apr 23, 2010 4:52 am Post subject: |
|
|
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...  |
|
| Back to top |
|
 |
Koo Voice
Joined: 02 Apr 2010 Posts: 37
|
Posted: Fri Apr 23, 2010 7:28 am Post subject: |
|
|
| 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.
It's like this:
| Quote: | <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. |
|
| Back to top |
|
 |
hm2k Halfop

Joined: 11 Sep 2006 Posts: 57 Location: UK
|
Posted: Mon Apr 26, 2010 5:18 pm Post subject: |
|
|
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. |
|
| Back to top |
|
 |
nml375 Revered One
Joined: 04 Aug 2006 Posts: 2857
|
Posted: Mon Apr 26, 2010 6:11 pm Post subject: |
|
|
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, idling at #eggdrop@IrcNET |
|
| Back to top |
|
 |
hm2k Halfop

Joined: 11 Sep 2006 Posts: 57 Location: UK
|
Posted: Tue Apr 27, 2010 6:14 am Post subject: |
|
|
Unfortunately this seems to be a limitation of the tz database itself rather than my script...
| Quote: | | 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. |
|
| Back to top |
|
 |
hm2k Halfop

Joined: 11 Sep 2006 Posts: 57 Location: UK
|
Posted: Tue Apr 27, 2010 11:12 am Post subject: |
|
|
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/r144/trunk/code/tcl/worldtime.tcl
For example:
| Quote: | [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! |
|
| Back to top |
|
 |
|