PDA

View Full Version : timevar2 is off?


100Zero100
01-21-2014, 04:12 PM
As of writing this:

http://www.epochconverter.com/

Says the Unix Epoch Time is: 1390323226

At the same time, I echoed timevar2.

Says timevar2 is equal to: 1390321106.845321893

Even using formatTimeString("", timevar2) now retrieves a time about 6 hours and 35 minutes off of the correct time.

Can anyone enlighten me on this?

Edit: getutctime() is also off by the same.

Edit2: In case you're feeling lazy, it appears off by 2120.

Edit3: It's only off by 35 minutes using the 2120 logic. I said it's off by 6 hours because using formatTimeStr() on it now yields time in EST. I suppose this was an internal fix Stefan made for some reason? It's unnecessary. My scripts wanted EST and so I just did -= 21600 in them. I removed my -= 21600 correction for EST and I have implemented a temporary += 2120 offset fix until this is sorted out.

TSAdmin
01-21-2014, 04:35 PM
Time in everything Graal related has been off for so long. EG: Scroll to the bottom of any forum page and look at what time it says it is, then look at your computer's clock.

http://i.imgur.com/etd0Tz3.png

100Zero100
01-21-2014, 04:44 PM
Time in everything Graal related has been off for so long. EG: Scroll to the bottom of any forum page and look at what time it says it is, then look at your computer's clock.

http://i.imgur.com/etd0Tz3.png

Not that long. The system was working perfectly in 2012 and timevar2 has been a properly functioning variable since 2005 when it was elevated from server uptime/graal installation time and turned into a clone of the unix time.

Somebody has very recently messed with formatTimeString() (corrected it into EST) and timevar2 (off by 2120) and made them incorrect.

The classic timevar also sucks. It does not truly update every 5 seconds. If you implement a time system off of timevar, you will find the time it yields you being off by about 1 day every 6 months.

There is no reason that timevar2, which should just directly read out the unix time, is off. Needs fix.

Torankusu
01-21-2014, 06:17 PM
http://forums.graalonline.com/forums/showthread.php?t=134268913

100Zero100
01-21-2014, 08:46 PM
Didn't know it was already covered. Thanks for bringing that up.

Very annoying.

Torankusu
01-21-2014, 09:26 PM
No problem, I actually remembered seeing it before but couldn't remember which sub forum it was in. I should bookmark for the workaround function example..

fowlplay4
01-22-2014, 05:13 AM
These are the two functions I wrote:


public function actualtimevar2(tv) {
// For converting real epoch timestamps to
// server's timevar2.
temp.offset = (60 * 6) - 12;
return tv - temp.offset;
}

public function determinetimevar2(str) {
// I.e. "2013-11-30 15:00:00 CST"
// Converts and offsets to match server timevar2.
return actualtimevar2(convertstringtotime("%Y-%m-%d %H:%M:%S %Z", str));
}


For exact-time events I recommend doing:

this.event_start = determinetimevar2("2014-01-21 18:00:00 CST");

Then using server's timevar2 and comparing it against this.event_start.