A Basic Interpreter written from scratch for the ESP8266

Moderator: Mmiscool

User avatar
By jimg
#63820 I have two noob questions:

1. What are the correct parameters to pass to the time.setup function to get daylight savings time to work?
In the example below, I tried several things for the second parameter, but always get standard time.

2. In the following test program, is it normal to have the time() function return zero for a while before it returns the correct results?
Code: Select allmemclear
cls
time.setup(-8,-7)
a$=time()
wprint a$ & "<br>"
i = 0
do
  i = i + 1
  b$=time()   
loop while a$=b$
wprint b$ & " took " & i & " loops<br>"
wait
end


I typically get the following results-

Thu Jan 01 00:00:00 1970
Thu Mar 16 17:32:54 2017 took 13 loops
User avatar
By heckler
#63823 I believe the time.setup(tz,dst) is looking for a 0 or 1 in the dst field
0=std time
1=dst

regards
dwight
User avatar
By jimg
#63825 I tried -1, 0, and 1 with no effect, still only give standard time.
It did take longer to initialize tonight. It take about 125 times through the loop to get a time. Strange.
User avatar
By nedudgi
#63827 You have to wait around five seconds after setting the time zone.
This setup has to be done only once on a module, as it writes to a resident data.

Code: Select allmemclear
cls
time.setup(-8,-7)
a$=time()
wprint a$ & "<br>"
delay 5000
i = 0
do
  i = i + 1
  b$=time()   
loop while a$=b$
wprint b$ & " took " & i & " loops<br>"
wait
end