Quantcast WoWInterface - View Single Post - (xpost) Server UTC time for events and functions
View Single Post
11-19-16, 11:51 AM   #4
semlar
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