On-Rev and Daylight Savings Time

Sarah Reichelt sarah.reichelt at gmail.com
Mon Aug 31 18:38:04 EDT 2009


> How can I handle daylight savings time in my On-Rev code?  We're currently
> in DST in Montreal.  When I type
>
>        put the long time
>
> in Revolution's message box, I get the correct time as
>
>        5:52:13 PM
>
> but when I ask for the long time in an On-Rev handler I get
>
>        4:52:13 PM
>
> which is standard time.


The problem is not daylight savings, but that you are getting the time
as it is at the On-Rev server, not the time where your computer is.

You can use a time conversion function, I have an example here
<http://www.troz.net/onrev/samples/showscript.irev?showscript=includes/time.irev>
- check the myTimeFn and adjust the local time zone in the first line
to match your time zone, allowing for daylight savings there.

Or you could store the time in seconds for the start & end of your
experiment. When the data gets back to your system, converting it will
convert it into your local time zone, and you can validate it there.
That won't stop the data being submitted outside the appropriate
hours, but you will be able to discard bad entries later.

Cheers,
Sarah



More information about the use-livecode mailing list