Does a day start at 1:00 AM everwhere?

Dar Scott dsc at swcp.com
Fri Oct 27 14:10:40 CDT 2006


On Oct 27, 2006, at 6:52 AM, Mark Powell wrote:

> At 6:42 this
> morning, I ran this:
>
>   put the short date into theDate
>   convert theDate to seconds
>   put ((the seconds - theDate) / 3600)
>
> and got 4.710556, which suggests that a date starts at 1:00 AM and not
> midnight.  Is this accurate?  And more importantly, is this the way  
> the
> computation would be handled on any client machine anywhere?

The Rev conversions are wrong.

Given any time zone and given any criteria for a new day, that time  
in seconds that just barely makes the seconds to short date  
conversion tick over to a new date should be just over what you get  
when you convert the new date to seconds.  That is not the case.  It  
is off by an hour.

I think seconds-to-date is right (and probably 'the short date') and  
the problem is in date-to-seconds.

Here is the script I used for my time-zone (-0700):

********************
on mouseUp
   put 7 * 3600 + 5 into s
   get s
   convert it to short date
   put it into d
   convert it to seconds
   put d && s && it && (s-it)/3600 & lf

   put 7 * 3600 - 5 into s
   get s
   convert it to short date
   put it into d
   convert it to seconds
   put d && s && it && (s-it)/3600 & lf after msg
end mouseUp
*********************
==>
1/1/70 25205 28800 -0.998611
12/31/69 25195 -57600 22.998611

The last column should be 0.014 and 23.998

As you can see 7 hours and 5 seconds is one date and 7 hours less 5  
seconds is another just before.  Converting the first date to seconds  
should get a value just under the seconds.  It does not.

Dar






More information about the use-livecode mailing list