Dave Moreau
Registered User
Join date: 22 Dec 2004
Posts: 29
|
07-30-2005 07:34
Hi guys, I'm having problems with the function on this page: http://secondlife.com/badgeo/wakka.php?wakka=llGetGMTclockWhen I use certain time offsets, the function returns odd times with negative or wrong values such as -1:-13:-2 PM (in non-military) and -30:-35:-24 etc in military. Can anyone possibly work out how to fix this? I really need a function that will let me get times in different timezones. Thanks!
|
Minsk Oud
Registered User
Join date: 12 Jul 2005
Posts: 85
|
07-30-2005 08:07
Just glancing at it, replacing the top part should fix it. It looks like the code initially defined raw as with no timezone adjustment, and was changed later. Try (have not compiled or tested this, but is a fairly trivial fix): string clock(float timezone, integer military) { integer shiftraw = (integer)(llGetGMTclock() + (timezone * 3600)); if (shiftraw >= 86400) shiftraw -= 86400; else if (shiftraw < 0) shiftraw += 86400;
integer hours = shiftraw / 3600; ...
Another bug is that both times will use an hour zero starting at midnight, which is only correct in military time (non-military should display 12:xx:xx PM for that first hour, toss a check into the non-military if-statement if you care). My change does prevent "24:00:00" appearing in military time with a positive timezone offset. Chris
|
Minsk Oud
Registered User
Join date: 12 Jul 2005
Posts: 85
|
07-30-2005 16:50
Sorry about the double-post, but having just dropped a lump of code in the Wiki I would appreciate confirmation that it works for other people. http://secondlife.com/badgeo/wakka.php?wakka=LibraryMilliTime
|
Strife Onizuka
Moonchild
Join date: 3 Mar 2004
Posts: 5,887
|
07-30-2005 18:46
*Twitches uncontrolably at the name of the page*
_____________________
Truth is a river that is always splitting up into arms that reunite. Islanded between the arms, the inhabitants argue for a lifetime as to which is the main river. - Cyril Connolly
Without the political will to find common ground, the continual friction of tactic and counter tactic, only creates suspicion and hatred and vengeance, and perpetuates the cycle of violence. - James Nachtwey
|