egghelp.org community Forum Index
[ egghelp.org home | forum home ]
egghelp.org community
Discussion of eggdrop bots, shell accounts and tcl scripts.
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Worldtime1.3.tcl working, again.
Goto page Previous  1, 2, 3, 4, 5, 6, 7  Next
 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Support & Releases
View previous topic :: View next topic  
Author Message
Koo
Voice


Joined: 02 Apr 2010
Posts: 37

PostPosted: Mon Apr 19, 2010 3:30 pm    Post subject: Re: speechles' worldtime Reply with quote

hm2k wrote:
Woops, my mistake, I mean this page:

No problem. Everyone makes mistake, myself included. Razz

hm2k wrote:
http://www.hm2k.com/posts/worldtime-tcl Smile

Nice script. Does it able to display the time for any city in the world? Very Happy

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
View user's profile Send private message
hm2k
Halfop


Joined: 11 Sep 2006
Posts: 57
Location: UK

PostPosted: Mon Apr 19, 2010 4:52 pm    Post subject: Reply with quote

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! Smile
Back to top
View user's profile Send private message
Koo
Voice


Joined: 02 Apr 2010
Posts: 37

PostPosted: Tue Apr 20, 2010 3:32 am    Post subject: Reply with quote

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! Smile

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. Very Happy
Back to top
View user's profile Send private message
hm2k
Halfop


Joined: 11 Sep 2006
Posts: 57
Location: UK

PostPosted: Tue Apr 20, 2010 4:46 am    Post subject: Reply with quote

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
View user's profile Send private message
Koo
Voice


Joined: 02 Apr 2010
Posts: 37

PostPosted: Tue Apr 20, 2010 5:51 am    Post subject: Reply with quote

hm2k wrote:
Latest version can be found here: http://hm2k.googlecode.com/svn/trunk/code/tcl/worldtime.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? Sad
Back to top
View user's profile Send private message
hm2k
Halfop


Joined: 11 Sep 2006
Posts: 57
Location: UK

PostPosted: Tue Apr 20, 2010 5:59 am    Post subject: Reply with quote

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
View user's profile Send private message
Koo
Voice


Joined: 02 Apr 2010
Posts: 37

PostPosted: Tue Apr 20, 2010 1:46 pm    Post subject: Reply with quote

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. Very Happy
Back to top
View user's profile Send private message
hm2k
Halfop


Joined: 11 Sep 2006
Posts: 57
Location: UK

PostPosted: Wed Apr 21, 2010 4:36 am    Post subject: Reply with quote

Jolly good, I knew you'd figure it out Smile
Back to top
View user's profile Send private message
Koo
Voice


Joined: 02 Apr 2010
Posts: 37

PostPosted: Fri Apr 23, 2010 4:47 am    Post subject: Reply with quote

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? Surprised
Back to top
View user's profile Send private message
hm2k
Halfop


Joined: 11 Sep 2006
Posts: 57
Location: UK

PostPosted: Fri Apr 23, 2010 4:52 am    Post subject: Reply with quote

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... Wink
Back to top
View user's profile Send private message
Koo
Voice


Joined: 02 Apr 2010
Posts: 37

PostPosted: Fri Apr 23, 2010 7:28 am    Post subject: Reply with quote

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... Wink

Oh sorry, I should give an example for it earlier. Razz

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
View user's profile Send private message
hm2k
Halfop


Joined: 11 Sep 2006
Posts: 57
Location: UK

PostPosted: Mon Apr 26, 2010 5:18 pm    Post subject: Reply with quote

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
View user's profile Send private message
nml375
Revered One


Joined: 04 Aug 2006
Posts: 2857

PostPosted: Mon Apr 26, 2010 6:11 pm    Post subject: Reply with quote

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
View user's profile Send private message
hm2k
Halfop


Joined: 11 Sep 2006
Posts: 57
Location: UK

PostPosted: Tue Apr 27, 2010 6:14 am    Post subject: Reply with quote

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
View user's profile Send private message
hm2k
Halfop


Joined: 11 Sep 2006
Posts: 57
Location: UK

PostPosted: Tue Apr 27, 2010 11:12 am    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Support & Releases All times are GMT - 4 Hours
Goto page Previous  1, 2, 3, 4, 5, 6, 7  Next
Page 4 of 7

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Forum hosting provided by Reverse.net

Powered by phpBB © 2001, 2005 phpBB Group
subGreen style by ktauber