BeBot - An Anarchy Online and Age Of Conan chat automaton

Archive => Age of Conan Archive => BeBot Hyborian support => Topic started by: Duffy on July 07, 2008, 11:20:03 pm

Title: The Time
Post by: Duffy on July 07, 2008, 11:20:03 pm
Where does the bot get the time information for time output from ?
My bot tells me the wrong time (i guess GMT) but in germany we currently use gmt+2. Systemclock of the unix box is set correctly
Title: Re: The Time
Post by: Nytridr on July 08, 2008, 10:42:14 am
When you do !time it should tell ya AO time

Code: [Select]
Rsbot: It is currently 08:37:27 July 8, 29482 Rubi-Ka Universal Time.
Title: Re: The Time
Post by: grasfer on July 08, 2008, 03:28:10 pm
Anyway to change the time it display to local time and not GMT?
Title: Re: The Time
Post by: Glarawyn on July 09, 2008, 07:03:26 am
No, which is pretty much intentional. :)

There is no decent way for php to figure out what your local timezone is (that I've found anyway.) Also, the bots logging and just about everything that deals with time is going by UTC time.
Title: Re: The Time
Post by: grasfer on July 09, 2008, 11:44:57 am
No, which is pretty much intentional. :)

There is no decent way for php to figure out what your local timezone is (that I've found anyway.) Also, the bots logging and just about everything that deals with time is going by UTC time.

So i guess php can't even check the system clock or something?
Title: Re: The Time
Post by: Noer on July 09, 2008, 12:11:43 pm
No, which is pretty much intentional. :)

There is no decent way for php to figure out what your local timezone is (that I've found anyway.) Also, the bots logging and just about everything that deals with time is going by UTC time.

So i guess php can't even check the system clock or something?

Yes it can. "date" checks the local system time and takes in account of timezone settings on the server. But it may be that Bebot is setup to use UTC as timezone as thats what AO operates in.
Title: Re: The Time
Post by: grasfer on July 09, 2008, 01:24:41 pm
Well, aint it possible to just remove AO code and just add a system clock check thingie? :P Or even add a system clock message to the !time message? :)
Title: Re: The Time
Post by: Vrykolas on July 09, 2008, 02:05:45 pm
PHP can check the system clock on the server it is running on (not any game servers) but not on the client - this means that the bot is not aware of the time zone your guild mates are in (which may not be the same as your or the servers time zone).

It is possible to modify the bot so that your members can manually change their own time zone, but this would only work correctly if displayed in tells (the guild chat would need to be a single timezone) or to be able to set a time zone for the bot, but this would require significant changes throughout the bot and any module that displays the time.

Far better, imho, to consistently display the time in UTC and let your members work out the difference themselves.
Title: Re: The Time
Post by: grasfer on July 09, 2008, 02:24:14 pm
ahhh, so the bot actually check the time from the chat server it is connected to and not from where the bot is running?
Title: Re: The Time
Post by: Vrykolas on July 09, 2008, 02:42:19 pm
no it checks the server it is running on - I used the wrong terminology there.
Title: Re: The Time
Post by: Noer on July 09, 2008, 02:51:25 pm
The easiest would just be to make a module for worldtime. :)

So it shows the time in several timezones in a popup.
Title: Re: The Time
Post by: grasfer on July 09, 2008, 03:50:33 pm
I'm sorry but i just can't see the logic here, if it check the time on server why can't it check the real time on the server and not gmt?
Title: Re: The Time
Post by: Vrykolas on July 09, 2008, 04:42:06 pm
it could - all you have to do is go through all the bots files and change the occurences of the function call gmdate to date, and re-apply the changes every time you update to a new version of the bot or install a new mod
Title: Re: The Time
Post by: Jovy on July 09, 2008, 06:23:55 pm
File: core/Time.php Line: 74

change:
$output = "It is currently ".gmdate("H:i:s F j,");

to:
$output = "It is currently ".date("H:i:s F j, Y");

gmdate() returns only GMT. date() uses the configured timezone
Title: Re: The Time
Post by: Vrykolas on July 09, 2008, 07:12:11 pm
File: core/Time.php Line: 74

change:
$output = "It is currently ".gmdate("H:i:s F j,");

to:
$output = "It is currently ".date("H:i:s F j, Y");

that will only affect !time, and leave the timestamps on the last seen on alts, whois, the log, the afks the roster along with several other things unchanged and still using UTC
Title: Re: The Time
Post by: Alreadythere on July 09, 2008, 09:02:31 pm
I'm sorry but i just can't see the logic here, if it check the time on server why can't it check the real time on the server and not gmt?
UNIX server have set their hardware clocks to GMT/UTC, they just use a timezone setting to display different timezones. gmdate() is getting the info of the hardware clock.

Why is bebot using the hardware clock (and with that GMT time)? Easy answer, almost everyone knows the relation of his time to GMT. And in AO there are people of every timezone on the same server, so using a time that can be converted easy is a plus there.
Title: Re: The Time
Post by: Jovy on July 10, 2008, 10:06:11 am
that will only affect !time, and leave the timestamps on the last seen on alts, whois, the log, the afks the roster along with several other things unchanged and still using UTC
so change where you can find gmdate()
Title: Re: The Time
Post by: Synt on August 15, 2008, 10:23:25 pm
I'm in the same seat, althou i have a suggestion would it be possible to add a preference to members so they can set their offset from GMT and the bot will remember it?
if this is at all possible it would be really nice.
My php skills is not up for the task tho.
Title: Re: The Time
Post by: Glarawyn on August 15, 2008, 10:52:33 pm
would it be possible to add a preference to members so they can set their offset from GMT and the bot will remember it?

Yes, and no. The problem is daylight savings time. There are (obviously) 24 different offset, but UTC offset is not the same as a time zone. Each time zone has different rules, such as Daylight Savings Time (USA), and European Summer Time, etc.

For example, I'm currently in the US Central time zone. The standard (CST) offset for this zone is -6. Currently we are under Daylight Savings Time rules, so we are under Central US Daylight Time (CDT), not CST. Now the lower 48 states have 4 different time zones (Eastern, Central, Mountain, Pacific). Should be easy right? No so much, there are states such as Arizona that do not follow Daylight Savings Time rules. Arizona is always Mountain Standard Time. To add another layer of complexity the Navajo Nation Reservations do follow the DST rules, so if you are in Arizona but are on the Navajo Nation Reservation you are (Today: 2008-08-15) on MDT.

To add more confusion, time zone rules are in flux. The current USA Energy Bill changed the rules for daylight savings time for 2007 and 2008, but these provisions expire in 2009 and the old rules will take effect again unless the 2009-2010 energy bill renews them.

As time zones are political in nature situations like this can simply be expected. PHP does have some functionality for figuring out time zones, but again, time zones are political. If the politicians change the rules PHP itself needs to be updated. Previoulsy, some older versions of PHP4 were completely unaware of the 2007-2008 US rule changes, while some PHP4 installations were not. To work around this, the BeBot developers would have had to know what the status of each PHP version is in terms of time zone rules, and create code to correct PHP's outdated rules if the bot was running on an older PHP version. A similar situation is likely on PHP5 if the US changes daylight savings times rules again.

After doing through research on the whole mess I opted for the easy way out and went with UTC time, which is an internationally recognized standard. Even though UTC is the international standard for time, the freaking Europeans can't figure out the difference between UTC and European Summer Time. People in London will often give the GMT/UTC time as being an hour ahead of the actual UTC time, and then tell you that they are right and you're wrong. Sorry guys, it's you who are screwed up not the rest of the world. European Summer Time is UTC+1 if you're in the +0 offset time zone...

So even the international standard for time is often confused and given incorrectly. Airline Pilots, ship captains, and computer programmers are generally the only people to get it right.  :P

So basically we've written off the whole timezone thing as way too much effort. Thank your local, national, and international politicians.

Title: Re: The Time
Post by: Synt on August 15, 2008, 11:00:45 pm
the suggestion wasn't to let the bot calculate the time zones, the suggestion was to let players have a setting for time and add +2 or -4
would that be easy or hard to make?
Title: Re: The Time
Post by: nhoople on August 16, 2008, 12:13:38 am
Gee whiz people, whats so hard about figuring out your time zone from the UTC?  If you use UTC as your standard when setting up events and raids, then everyone is on the same sheet of music.
SimplePortal 2.3.7 © 2008-2025, SimplePortal