Graal Forums  

Go Back   Graal Forums > Development Forums > NPC Scripting
FAQ Members List Calendar Today's Posts

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 01-21-2014, 04:12 PM
100Zero100 100Zero100 is offline
Registered User
Join Date: Jul 2006
Posts: 31
100Zero100 is on a distinguished road
timevar2 is off?

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.
__________________
Hi. I'm NaS!

Last edited by 100Zero100; 01-21-2014 at 04:33 PM..
Reply With Quote
  #2  
Old 01-21-2014, 04:35 PM
TSAdmin TSAdmin is offline
Forum Moderator
TSAdmin's Avatar
Join Date: Aug 2006
Location: Australia
Posts: 1,980
TSAdmin is a splendid one to beholdTSAdmin is a splendid one to beholdTSAdmin is a splendid one to beholdTSAdmin is a splendid one to beholdTSAdmin is a splendid one to behold
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.

__________________
TSAdmin (Forum Moderator)
Welcome to the Official GraalOnline Forums! Where sharing an opinion may be seen as a declaration of war!
------------------------
· User Agreement · Code of Conduct · Forum Rules ·
· Graal Support · Administrative Contacts ·
Reply With Quote
  #3  
Old 01-21-2014, 04:44 PM
100Zero100 100Zero100 is offline
Registered User
Join Date: Jul 2006
Posts: 31
100Zero100 is on a distinguished road
Quote:
Originally Posted by TSAdmin View Post
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.

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.
__________________
Hi. I'm NaS!
Reply With Quote
  #4  
Old 01-21-2014, 06:17 PM
Torankusu Torankusu is offline
Elite Member
Torankusu's Avatar
Join Date: Jun 2001
Posts: 10,065
Torankusu has a spectacular aura aboutTorankusu has a spectacular aura about
http://forums.graalonline.com/forums...hp?t=134268913
__________________
Quote:
Originally posted by Spark910
Think befreo you type.
Reply With Quote
  #5  
Old 01-21-2014, 08:46 PM
100Zero100 100Zero100 is offline
Registered User
Join Date: Jul 2006
Posts: 31
100Zero100 is on a distinguished road
Didn't know it was already covered. Thanks for bringing that up.

Very annoying.
__________________
Hi. I'm NaS!
Reply With Quote
  #6  
Old 01-21-2014, 09:26 PM
Torankusu Torankusu is offline
Elite Member
Torankusu's Avatar
Join Date: Jun 2001
Posts: 10,065
Torankusu has a spectacular aura aboutTorankusu has a spectacular aura about
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..
__________________
Quote:
Originally posted by Spark910
Think befreo you type.
Reply With Quote
  #7  
Old 01-22-2014, 05:13 AM
fowlplay4 fowlplay4 is offline
team canada
fowlplay4's Avatar
Join Date: Jul 2004
Location: Canada
Posts: 5,200
fowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond repute
These are the two functions I wrote:

PHP Code:
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.
__________________
Quote:
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 01:42 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.