Thread Tools Display Modes
02/15/16, 12:53 PM   #1
JohnnyKing94
 
JohnnyKing94's Avatar
Join Date: Mar 2015
Posts: 45
Get current time and dst

Is there any way to determine if the current time is DST or not?
In native lua it would be something like this

Lua Code:
  1. local now = os.time()
  2. local t = os.date("*t", now)
  3. print(t.isdst)

that would print "true" or "false"... i'm trying to find something working for Elder Scrolls if it's available... i need to do some actions if the os time is DST or not...
  Reply With Quote
02/15/16, 02:45 PM   #2
haggen
 
haggen's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2015
Posts: 137
This thread answers it:
http://www.esoui.com/forums/showthread.php?t=6097
  Reply With Quote
02/15/16, 05:15 PM   #3
JohnnyKing94
 
JohnnyKing94's Avatar
Join Date: Mar 2015
Posts: 45
Originally Posted by haggen View Post
none of those returns a true or a false for DST... i need to know if the OS time is DST or not, i don't need the time in timestamp or in UTC...
  Reply With Quote
02/15/16, 05:37 PM   #4
Ayantir
 
Ayantir's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2014
Posts: 1,019
Not really doable. What is your real need ?
  Reply With Quote
02/15/16, 05:56 PM   #5
JohnnyKing94
 
JohnnyKing94's Avatar
Join Date: Mar 2015
Posts: 45
Originally Posted by Ayantir View Post
Not really doable. What is your real need ?
As i asked in the first post, i need to know if the os time is dst or not... with this condition i need to do some actions... but basically like in native lua, i'd like to use isdst just to do some stuff...
  Reply With Quote
02/15/16, 06:35 PM   #6
Ayantir
 
Ayantir's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2014
Posts: 1,019
Same question. What is your *real* need ?

If you want to set a countdown for daylies, it's not really doable.
I never checked if time of reset was changed due to dst but maybe someones did it.

You cannot know if time is summer time, winter or if clock is badly set. You just got OS clock, that's all.

A screen :

  Reply With Quote
02/16/16, 02:22 AM   #7
votan
 
votan's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2014
Posts: 578
Originally Posted by Ayantir View Post
I never checked if time of reset was changed due to dst but maybe someones did it.
Last time I did take care, the daily alchemy writ reset changed from 07:00 to 08:00 due to daylight saving. So, I assume the reset of writs, boss dailies and fence is at different, but specific fixed times for UTC+0.

/edit: maybe this time differs for EU/NA. 06:00 in the morning seems to be a good reset time.
/edit 2: And due to clock drifts between client and server the reset differs +/- 5min at worst (2.5min avg).

Last edited by votan : 02/16/16 at 02:54 AM.
  Reply With Quote
02/16/16, 06:08 AM   #8
Wandamey
Guest
Posts: n/a
it seems to be the same time UTC for both servers.

not sure if anything is worth a constant check for a twice-a-year change though.


edit : here phinix worked with OS times. He would have saved himself some hair by working directly with UTC (aka dailies at fixedtime+n*fixedinterval all year long), but all the conversions you need are there. link : http://www.esoui.com/downloads/fileinfo.php?id=1251
Only he had to do a manual setting for the DST.
Now if you want to compare a daily event to the clock to determine if DST, that would require users to be online at insane times and that would be even worse than checking a real-life calendar for one only zone. (not all the planet changes at the same time)

Last edited by Wandamey : 02/16/16 at 06:40 AM.
  Reply With Quote
02/16/16, 07:02 AM   #9
sirinsidiator
 
sirinsidiator's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 1,580
As others mentioned, getting a simple "isDST" is really complicated. There are several solutions:
  1. You write your own IsDST function that knows which country the user is in (via a setting) and which DST dates the country is using.
  2. You let the user select if he has DST or not right now (via a setting).
  3. You ask on the wishlist for ZOS to add an IsDST function.
  4. You don't rely on that information.
  5. You tell us what exactly your use case is and we tell you why you don't need it.
  Reply With Quote

ESOUI » Developer Discussions » Lua/XML Help » Get current time and dst


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