-->
Page 1 of 3

Time

PostPosted: Thu Mar 16, 2017 8:34 pm
by jimg
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

Re: Time

PostPosted: Thu Mar 16, 2017 9:48 pm
by heckler
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

Re: Time

PostPosted: Thu Mar 16, 2017 11:25 pm
by jimg
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.

Re: Time

PostPosted: Fri Mar 17, 2017 1:18 am
by nedudgi
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