Thread Tools Display Modes
02/12/16, 03:51 PM   #1
haggen
 
haggen's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2015
Posts: 137
Reliability of time functions

Could somebody (preferably Chip himself :P) answer me in detail how the functions below calculate the time, and what timezone they're in.

1. GetTimeStamp
2. GetFormattedTime
3. GetTimeString
4. GetDate
5. GetGameTimeMilliseconds
6. GetFrameTimeMilliseconds
7. GetFrameTimeSeconds
8. GetSecondsSinceMidnight

I'm particularly interested if any of the functions are based on the server's local time instead of the client's.

Thanks in advance!

Last edited by haggen : 02/12/16 at 03:56 PM.
  Reply With Quote
02/12/16, 08:55 PM   #2
Ayantir
 
Ayantir's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2014
Posts: 1,019
Originally Posted by haggen View Post
Could somebody (preferably Chip himself :P) answer me in detail how the functions below calculate the time, and what timezone they're in.

1. GetTimeStamp
2. GetFormattedTime
3. GetTimeString
4. GetDate
5. GetGameTimeMilliseconds
6. GetFrameTimeMilliseconds
7. GetFrameTimeSeconds
8. GetSecondsSinceMidnight

I'm particularly interested if any of the functions are based on the server's local time instead of the client's.

Thanks in advance!
  1. OS local
  2. OS local
  3. OS local
  4. OS local
  5. N/A
  6. N/A
  7. N/A
  8. OS local
  Reply With Quote
02/13/16, 02:26 AM   #3
votan
 
votan's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2014
Posts: 577
Originally Posted by haggen View Post
1. GetTimeStamp
2. GetFormattedTime
3. GetTimeString
4. GetDate
5. GetGameTimeMilliseconds
6. GetFrameTimeMilliseconds
7. GetFrameTimeSeconds
8. GetSecondsSinceMidnight
In addition to Ayantir's post:
1. Is UTC+0 for everybody, including the server. It is client local, but if synced with Network Time Protocol*, the same time as the server has.
UNIX timestamp: Seconds since 1/1/1971
5. Milliseconds since program started. (Not since character in world)
6/7: Same as 5, but a snapshot for the frame currently rendered. GetGameTimeMilliseconds>=GetFrameTimeMilliseconds. If greather than 16.667ms no more 60fps.
8: Client local seconds of the day, including daylight saving.
Current time shift compared to 1:
Code:
	local localTimeShift = GetSecondsSinceMidnight() -(GetTimeStamp() % 86400)
	if localTimeShift < -12 * 60 * 60 then localTimeShift = localTimeShift + 86400 end
*Cleartext: Your clock is running correct.

Last edited by votan : 02/13/16 at 03:03 AM.
  Reply With Quote
02/13/16, 05:26 AM   #4
coolmodi
AddOn Author - Click to view addons
Join Date: Mar 2015
Posts: 47
Originally Posted by votan View Post
In addition to Ayantir's post:
1. Is UTC+0 for everybody, including the server. It is client local, but if synced with Network Time Protocol*, the same time as the server has.
UNIX timestamp: Seconds since 1/1/1971

*Cleartext: Your clock is running correct.
Sadly even with synced time over the web it won't be the same. For Haggen and me it was off by around a minute. Not much, but it's still useless if you want to somehow export data with correct time, like combat logs or whatever.
  Reply With Quote
02/13/16, 05:57 AM   #5
votan
 
votan's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2014
Posts: 577
Originally Posted by coolmodi View Post
Sadly even with synced time over the web it won't be the same. For Haggen and me it was off by around a minute. Not much, but it's still useless if you want to somehow export data with correct time, like combat logs or whatever.
Well, once you know, that you have to check that:
https://technet.microsoft.com/en-us/...=ws.10%29.aspx:

"Support boundary to configure the Windows Time service for high accuracy environments
We do not guarantee and we do not support the accuracy of the W32Time service between nodes on a network. The W32Time service is not a full-featured NTP solution that meets time-sensitive application needs. The W32Time service is primarily designed to do the following:

Make the Kerberos version 5 authentication protocol work.
Provide loose sync time for client computers.The W32Time service cannot reliably maintain sync time to the range of 1 to 2 seconds. Such tolerances are outside the design specification of the W32Time service."

Kerberos tolerance is about 5min.

If you want to do that, you may need to download a real NTP client.
  Reply With Quote
02/13/16, 06:57 AM   #6
silentgecko
 
silentgecko's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2015
Posts: 6
thanks all for making things clear here.
i started the discussion about it yesterday in our dev-chat

the reason behind this question is that i want to make a combat log export, like wow logs, and for this all timestamps from all players (for e.g. in group) have to be in sync. otherwise you'll have an offset.

i think i have to add a datasync before the fight starts, to get all players in sync :/ i hoped that i don't have to
  Reply With Quote
02/13/16, 07:31 AM   #7
haggen
 
haggen's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2015
Posts: 137
Thank you so much Votan and Ayantir for the excellent information and coolmodi and silentgecko for the enlightening discussion.
  Reply With Quote

ESOUI » Developer Discussions » General Authoring Discussion » Reliability of time functions

Thread Tools
Display Modes

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

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