Thread Tools Display Modes
08/09/15, 09:13 AM   #1
kerb9729
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 56
Determining the player's timezone

GetTimeStamp() seems to return the time in UTC.

Is there any way to determine the current system timezone without forcing the user to configure it?

I suppose I could calculate it by converting GetTimeString() to a unix timestamp somehow, but it seems like there should be a better way.

I have a simple addon that predicts what time an in-game time will occur in real time and displays it in the chat window. It gets game time from the "Tamriel Standard Time" addon. So I guess in reality it's an addon to an addon.

Currently I just hard code my timezone, but I thought I might clean it up and release it. Or give the code to "Tamriel Standard Time" guy so he can incorporate it into his addon if he wants.

It's pretty useful if you are trying to become a vamp or ww the hard way. It's nice to know what time you need to be online to check the spawns.

Last edited by kerb9729 : 08/09/15 at 09:32 AM.
  Reply With Quote
08/09/15, 09:25 AM   #2
votan
 
votan's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2014
Posts: 577
Originally Posted by kerb9729 View Post
GetTimeStamp() seems to return the time in UTC.

Is there any way to determine the current system timezone without forcing the user to configure it?

I suppose I could calculate it by converting GetTimeString() to a unix timestamp somehow, but it seems like there should be a better way.

I have a little 5 line addon that predicts what time an in-game time will occur in real time and displays it in the chat window. It gets game time from the "Tamriel Standard Time" addon. So I guess in reality it's an addon to an addon.

Currently I just hard code my timezone, but I thought I might clean it up and release it. Or give the code to "Tamriel Standard Time" guy so he can incorporate it into his addon if he wants.

It's pretty useful if you are trying to become a vamp or ww the hard way. It's nice to know what time you need to be online to check the spawns.
The way I found is:
Lua Code:
  1. local localTimeShift = GetSecondsSinceMidnight() -(GetTimeStamp() % 86400)
  2.   if localTimeShift < -12 * 60 * 60 then localTimeShift = localTimeShift + 86400 end
And yes, GetTimeStamp() is UTC and GetSecondsSinceMidnight() is current clients time including daylight saving.
  Reply With Quote
08/09/15, 09:33 AM   #3
kerb9729
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 56
Originally Posted by votan View Post
The way I found is:
Lua Code:
  1. local localTimeShift = GetSecondsSinceMidnight() -(GetTimeStamp() % 86400)
  2.   if localTimeShift < -12 * 60 * 60 then localTimeShift = localTimeShift + 86400 end
And yes, GetTimeStamp() is UTC and GetSecondsSinceMidnight() is current clients time including daylight saving.
This is exactly what I needed, thanks very much!
  Reply With Quote

ESOUI » Developer Discussions » General Authoring Discussion » Determining the player's timezone


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