[REBOL] Re: Daylight saving (Was: RE: Re: Swatch time)
From: gchiu:compkarori at: 8-Oct-2001 23:27
On Mon, 8 Oct 2001 08:58:36 +0100
Cassani Mario <[Mario--Cassani--icl--com]> wrote:
> >
> How can I know if the Daylight saving are "active" or
I just switched to daylight saving. The day before
yesterday
>> now/zone
== 12:00
Today
>> now/zone
== 13:00
> not?
> The two different versions of 'internet-time suggested
> in the thread give different results on my computer and a
Here's my amended version that is embeddded into my chat
client and now uses the /hour/minute/second refinements of
time
; converts a time value into internet time
to-internettime: func [ time [time!] timezone [time!] /local
gmttime ] [
gmttime: time - timezone
if gmttime < 0:00 [ gmttime: gmttime + 24:00 ]
if gmttime > 24:00 [ gmttime: gmttime - 24:00 ]
gmttime: ( ( ( gmttime/hour * 3600 ) + ( gmttime/minute *
60 ) + gmttime/second ) / 86.40 ) + 41 ; offset from GMT/UTC
if gmttime > 1000 [ gmttime: gmttime - 1000 ]
return ( to-integer ( gmttime * 100 ) ) / 100
]
; returns local time in beats
internettime: does [
return to-internettime now/time now/zone
]
I've checked it a few times with the one on swatch.com and
it agrees to within a few beats.
> I am using NT 4.0 sp6 (I know, it's a shame).
Me too.
--
Graham Chiu