(xpost) Server UTC time for events and functions - WoWInterface
Thread Tools Display Modes
11-17-16, 01:41 PM   #1
A Defias Bandit
Join Date: Nov 2016
Posts: 2
(xpost) Server UTC time for events and functions

I posted a fairly long request on the official forums here. I've copied the post verbatim below so please feel free to comment in either place.


It looks like this has been brought up a few times in the past. I couldn't find a recent post so I apologize if this is a repost or has been discussed recently.

Being the nerds that we are - I'm sure I'm not alone in having a desire for very accurate timestamp data. Many people would be able to immediately use it as it relates to the combat log. I've got some ideas where it would be great for chat events. And I'm sure people will find lots of uses for the data.

The sharding changes with Legion have been great from a gameplay point of view - but they make managing time stamps even more difficult than before as the actual server time has all but become useless.

  • 1) Additional EVENT parameter containing Server UTC time in ms
  • 2) Function to return current Server Time, in UTC, to ms accuracy
I realize that doing this perfectly increases server bandwidth, however I think the impact can be minimized via intelligent local maintenance of the current server time.

I believe by doing three things accurate data could be available.
  • First, maintain a variable locally containing the millisecond offset from local UTC time to server UTC time.
  • Second, periodically check with the server for large differences in local PC time and server time.
  • Third, with each event a 2-byte value containing a value of 0-59999 representing the second and millisecond the event occurred on the server.
Using item 1 would allow for a function call to return Server UTC Time any time it is needed. This will of course never be perfect, but the longer you are connected the more accurate it would become.

Using item 3 would allow for 100% accurate synchronization for >99% of events fired. The edge case here would be a 60s+ latency followed by a catch-up where event timing is overlaps due to only sharing the 2-byte code.

Using items 2 and 3, in combination with latency tracking would allow for a simple algorithm to keep the local server time as accurate as possible.

Minimal beneficial change:
With strictly the addition of the 2-byte value above, I believe the community could create on our own the rest of the necessary API to good accuracy, though slightly less-so than would be available from a Blizzard implementation.

Comment Requests:
  • Would love to have a Blue response on the subject - even if it's as simple as one of "Likely never to happen", "Will investigate for the future", "On the todo list, but not prioritized", or "Coming soon"
  • Community feedback - Would you use this? How would it help?
  • Community feedback - Did I request enough for our needs?
  • Community feedback - Feasibility of my implementation; alternate implementations
And of course please provide anything else you can think of. I'm happy to edit in ideas and benefits into this post as a summary if we get some traction going.

Lastly - I'm going to cross post to wowinterface and to curseforge. Please feel free to cross post and let me know of anywhere else you share this.
  Reply With Quote
11-18-16, 01:41 AM   #2
A Fallenroot Satyr
AddOn Author - Click to view addons
Join Date: Oct 2010
Posts: 29
What's the use-case for this change?

Sent from my SAMSUNG-SM-G920A using Tapatalk
  Reply With Quote
11-18-16, 03:59 AM   #3
A Defias Bandit
Join Date: Nov 2016
Posts: 2
The short answer is: For a pet projet - an accurate time that chat log events occured on the server that was reliable and consistent between asynchronous players would be useful.

I imaging that people really digging into the combat log would appreciate it at times as well and that people would have other use cases for it that I wouldn't be aware of.

I'll admit I tried to jump the gun by assuming overhead issues and making a much more complicated solution than simply just adding the Server UTC timestamp to any events received from the server.
  Reply With Quote
11-19-16, 11:51 AM   #4
A Pyroguard Emberseer
semlar's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2007
Posts: 1,059
It sounds like what you want is a function that returns a timestamp from a single time server, because different servers aren't necessarily going to be in sync.

You can actually produce a UTC timestamp from the server using time(date('!*t', GetServerTime())), assuming the timezone on the player's computer is set correctly.

Milliseconds can be calculated as accurately as possible using an OnUpdate script and tracking elapsed time since GetServerTime() changed seconds.

In the interest of efficiency, once you've converted the server time to UTC it would be best to get the difference between that and GetServerTime() or time() and use that to avoid having to repeatedly convert it using date() because of the substantial overhead.

This method may or may not work for your project, but I figured I'd mention it here anyway.
  Reply With Quote
11-19-16, 08:08 PM   #5
A Fallenroot Satyr
AddOn Author - Click to view addons
Join Date: Oct 2010
Posts: 29
It sounds like the problem is more that the client receives events in a different order than the server generated them sometimes.

Having the server ensure that events are well-ordered when received by the client seems hard -- it would imply needing some sort of ACK for each event, which implicitly doubles network traffic.

Putting a server timestamp on each event would at least allow for clients to reorder events, but don't you run into other problems like detecting when an event has arrived out of order without having to buffer events in a window and delay processing them?

Sent from my SAMSUNG-SM-G920A using Tapatalk
  Reply With Quote
11-20-16, 05:49 AM   #6
A Pyroguard Emberseer
SDPhantom's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2006
Posts: 1,991
The game server doesn't necessarily generate events like you see in the UI. The server and client exchange information constantly and it's up to the game client to generate events when it deems necessary. The server has nothing to do with it and doesn't care in the slightest.
ESOUI AddOns | WoWInterface AddOns
"All I want is a pretty girl, a decent meal, and the right to shoot lightning at fools."
-Anders (Dragon Age: Origins - Awakening)

Last edited by SDPhantom : 11-20-16 at 05:52 AM.
  Reply With Quote

WoWInterface » Developer Discussions » Wish List » (xpost) Server UTC time for events and 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