Date/Time Difference - Feature or Bug?
[1/3] from: gjones05::mail::orion::org at: 11-May-2001 13:22
While working with date/time(s) in REBOL between time zones, I noticed
what seems to be an unexpected result.
t1: 11-May-2001/13:08:52-5:00
t2: 11-May-2001/13:08:52-7:00
t1/time - t2/time ; result 0:00 ... because of path refinement, ok
t1/zone - t2/zone ; result 2:00 ... ok
t1 - t2 ; result 0 ... hmmm
equal? t1 t2 ; result false ... ok
Given the GMT offset, it seems as though the calculation t1 - t2 should
give a 2 hour difference. Am I missing something obvious?
--Scott Jones
[2/3] from: lmecir:mbox:vol:cz at: 11-May-2001 23:30
Hi,
> While working with date/time(s) in REBOL between time zones, I noticed
> what seems to be an unexpected result.
<<quoted lines omitted: 7>>
> give a 2 hour difference. Am I missing something obvious?
> --Scott Jones
See this:
t1: 11-May-2001/13:08:52-5:00
t2: 10-May-2001/15:08:52-5:00
t1 - t2 ; == 1
The meaning: t1 - t2 is the number of days between two dates.
Moreover:
t1: 11-May-2001/13:08:52-5:00
t2: 11-May-2001/13:08:52-7:00
t1 < t2 ; == true
Regards
Ladislav
[3/3] from: gjones05:mail:orion at: 11-May-2001 17:36
From: "Ladislav Mecir"
> > While working with date/time(s) in REBOL between time zones, I
noticed
> > what seems to be an unexpected result.
> >
<<quoted lines omitted: 6>>
> >
> > Given the GMT offset, it seems as though the calculation t1 - t2
should
> > give a 2 hour difference. Am I missing something obvious?
> > --Scott Jones
<<quoted lines omitted: 10>>
> Regards
> Ladislav
Well, the final comparison (t1 < t2 ; == true) is reassuring, and (type?
t1) does return date!. But it still seems inconsistent when the
interpreter recognizes one as being less than the other, but the
difference is computed as 0.
I genuinely appreciate your response. Of course the "problem" is easily
worked with (around), it just surprised me. Thanks!
--Scott Jones
Notes
- Quoted lines have been omitted from some messages.
View the message alone to see the lines that have been omitted