Thread Tools Display Modes
01-02-15, 08:34 PM   #1
Vrul
A Scalebane Royal Guard
 
Vrul's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2007
Posts: 404
Realm UTC Offset

Is there a way to consistently get a realm's UTC offset other than hardcoding them all in?
  Reply With Quote
01-02-15, 11:17 PM   #2
Seerah
Fishing Trainer
 
Seerah's Avatar
WoWInterface Super Mod
Featured
Join Date: Oct 2006
Posts: 10,860
Could you compare the UTC with the game time?
http://wowprogramming.com/docs/api/GetGameTime
__________________
"You'd be surprised how many people violate this simple principle every day of their lives and try to fit square pegs into round holes, ignoring the clear reality that Things Are As They Are." -Benjamin Hoff, The Tao of Pooh

  Reply With Quote
01-03-15, 08:52 AM   #3
Vrul
A Scalebane Royal Guard
 
Vrul's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2007
Posts: 404
Originally Posted by Seerah View Post
Could you compare the UTC with the game time?
No, that gives you the server time which can change when you switch to an instance.
  Reply With Quote
01-03-15, 10:35 AM   #4
Rilgamon
Premium Member
 
Rilgamon's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Sep 2009
Posts: 822
Formatting 'date' with http://strftime.net/ should help. (I'd guess %z / %Z)
http://wow.gamepedia.com/API_date
__________________
The cataclysm broke the world ... and the pandas could not fix it!
  Reply With Quote
01-03-15, 11:02 AM   #5
Choonstertwo
A Chromatic Dragonspawn
 
Choonstertwo's Avatar
AddOn Author - Click to view addons
Join Date: Jan 2011
Posts: 194
Originally Posted by Rilgamon View Post
Formatting 'date' with http://strftime.net/ should help. (I'd guess %z / %Z)
http://wow.gamepedia.com/API_date
%Z is the time zone name (without the offset), so it's not much use without a hardcoded mapping of time zone names to offsets.

%z is the time zone offset on Mac, but it's an alias of %Z on Windows.

(I did a bit of research on the date function and which specifiers work on each platform here and here)
  Reply With Quote
01-03-15, 08:28 PM   #6
Vrul
A Scalebane Royal Guard
 
Vrul's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2007
Posts: 404
Originally Posted by Rilgamon View Post
Formatting 'date' with http://strftime.net/ should help. (I'd guess %z / %Z)
As ChoonsterTwo stated %z is the same as %Z for Windows but more importantly that would only tell me the computer's UTC offset when I need the realm's UTC offset.
  Reply With Quote
01-04-15, 03:38 AM   #7
SDPhantom
A Pyroguard Emberseer
 
SDPhantom's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2006
Posts: 2,325
If you get the computer's offset, you can calculate the server by comparing server time with computer time.
__________________
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)
  Reply With Quote
01-04-15, 08:27 AM   #8
Vrul
A Scalebane Royal Guard
 
Vrul's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2007
Posts: 404
Originally Posted by SDPhantom View Post
If you get the computer's offset, you can calculate the server by comparing server time with computer time.
But I need the realm time which isn't always the same as the server time. I was hoping someone knew a clever trick or an API I missed that would avoid the convoluted mess needed to get something so simple (and still not even be guaranteed to be correct). As best as I can figure there will always be an edge case where I won't know the realm time for sure.
  Reply With Quote
01-04-15, 09:47 AM   #9
Talyrius
An Onyxian Warder
 
Talyrius's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2008
Posts: 363
It's a long shot, but I'd suggest asking for it on the Wish List forum.
  Reply With Quote
01-04-15, 10:21 AM   #10
Vrul
A Scalebane Royal Guard
 
Vrul's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2007
Posts: 404
Yeah, I just read through all the notes for GetGameTime and whoever wrote that came to the same conclussion as me, there will always be an edge case where you just don't know.

I also found that when you logout from one realm and login to a realm with a different time zone, the first realm's time will be returned by GetGameTime until WORLD_MAP_UPDATE fires the second time.
  Reply With Quote
01-05-15, 08:03 PM   #11
SDPhantom
A Pyroguard Emberseer
 
SDPhantom's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2006
Posts: 2,325
It was more reliable before the whole CRZ stuff rolled in. Now the server handling the zone you're in isn't necessarily hosted by your realm server and may be hosted by another realm at any other time. I think there are still restrictions in place in which racial capitals are still restricted to your local realm or "connected" realms. I suppose the next question is, are all "connected" realms located in the same data center in respect to the realms they're attached to?

PS: We know instance servers can and often do span between separate data centers.
__________________
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 : 01-05-15 at 08:08 PM.
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » Realm UTC Offset


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