A Basic Interpreter written from scratch for the ESP8266

Moderator: Mmiscool

User avatar
By jimg
#63866 okay, I see it now at the bottom of the code.

Code: Select allif ((DST = 1) and (dow = "Sun") and (month = "Nov") and (day >= 1) and (day < 8)) then
 DST = 0
 write(DaylightSavings,str(DST))
endif

if ((DST = 0) and (dow = "Sun") and (month = "Mar") and (day >=8) and (day < 15)) then
 DST = 1
 write(DaylightSavings,str(DST))
endif


I was hoping there was something automatically coming from nist for the next time the goverment decides to change what date DST starts and ends.
Last edited by jimg on Fri Mar 17, 2017 7:39 pm, edited 1 time in total.
User avatar
By jimg
#63868 Reading up on the problem here https://www.nist.gov/pml/time-and-frequency-division/popular-links/daylight-saving-time-dst, dst info is available using the Daytime Protocol. I have no idea how difficult it would be to implement such a thing.

Again my apologies for all this whining, I just made the rash assumption that it would all be handled automatically in this day and age.
User avatar
By heckler
#63871 jimg,

Not whining (at least I did not see it that way) just trying to understand.
I did not realize that you did not realize that you had to tell the module (or give it the code to test, based on a calendar) when DST was in effect.

I went through this same exercise a few months ago.

I think the reason that NTP servers do not respect the changing of time to DST is that an NTP server is providing time to the whole world (I could be wrong here, I'm just guessing)

But his code to determine when DST is in effect seems to be a good solution.

cheers
dwight
User avatar
By forlotto
#68538
Code: Select all; Not the first number -3 is the timezone based off of UTC  the second number 0 for dst 1 for no dst
timesetup(-3,0)
; Below you must include a delay for the time to be setup before you can print or use it IMPORTANT!
delay 5000
;Below is the function to print time
print time()
end


Enjoy hope this helps also if you have any further questions you can refer to documentation or the beginners guide in my signature.