The seconds problem - redefined

Sarah Reichelt sarahr at genesearch.com.au
Thu Apr 15 20:00:55 EDT 2004


snip
>      Hope that helps. Now back to the original question. Is there a 
> way to
> convert dates to seconds where every day has 86400 seconds?
>      Note: For this purpose, I don't care whether the seconds start at 
> GMT or
> GMT - 10. I'm not concerned about time zones, daylight savings time, 
> etc. It
> doesn't matter to me if the eon starts in 1900, 1904, or 1970. I just 
> want a
> way to convert dates to consistent seconds - without having to 
> introduce extra
> calculations for short and long day variations.
>      1. Does such a conversion exist in Revolution now?
>      2. If not, shouldn't it?

Hi Paul,
Sorry for misunderstanding and thanks for supplying the detailed 
explanation of your goal. I completely support your plan of storing 
dates as a number. The formatting and sorting issues when using any 
formatted dates are too unreliable to use.

However it seems that your problem needs an alternative solution as the 
seconds will not do exactly what you want. You could use a range 
comparison rather than an exact match, although if you list is very 
large, that might be too slow. Perhaps you could have two lists: one 
pending and one already completed. As each task's date is passed, it 
can be moved to the "Completed" list and reduce the size of the pending 
list. Then you only need to loop through until you find the first event 
after your required time span.

Another untested idea is to set every event to midday on the specified 
date. The seconds might match up in this case, although you still 
couldn't rely on each day being exactly 86400 seconds.

However Julian dates are still probably the best way to go.

Keep us informed as to your progress and final solution.

Cheers,
Sarah
sarahr at genesearch.com.au
http://www.troz.net/Rev/



More information about the use-livecode mailing list