Mailing List Archive: 49091 messages

# Date math bug?

### [1/6] from: bga::bug-br::org::br at: 24-Mar-2004 10:14

>> test1: 24-Mar-2004/00:00:01-3:00
== 24-Mar-2004/0:00:01-3:00
>> test2: 23-Mar-2004/00:00:02-3:00
== 23-Mar-2004/0:00:02-3:00
>> probe test1 - test2
1 == 1
>> test1: now
== 24-Mar-2004/10:11:04-3:00
>> test2: now
== 24-Mar-2004/10:11:09-3:00
>> probe test1 - test2
0 == 0 Am I missing something? -Bruno

### [2/6] from: gchillemi:aliceposta:it at: 24-Mar-2004 14:28

Bruno, it seems that you can't make the difference of a date/time with another greater. In the second example, the correct expression is test2 - test1 Giuseppe

### [3/6] from: g:santilli:tiscalinet:it at: 24-Mar-2004 16:13

Hi Giuseppe, On Wednesday, March 24, 2004, 2:28:22 PM, you wrote: GC> Bruno, it seems that you can't make the difference of a date/time with GC> another greater. GC> In the second example, the correct expression is test2 - test1 The problem actually is that SUBTRACT returns the number of days between the two dates; so the result is correct. You have to use DIFFERENCE if you want more precision.
>> d1: now
== 24-Mar-2004/16:12:55+1:00
>> d2: now
== 24-Mar-2004/16:13:05+1:00
>> d2 - d1
== 0
>> difference d2 d1
== 0:00:10 Regards, Gabriele. -- Gabriele Santilli <[g--santilli--tiscalinet--it]> -- REBOL Programmer Amiga Group Italia sez. L'Aquila --- SOON: http://www.rebol.it/

### [4/6] from: greggirwin:mindspring at: 24-Mar-2004 8:19

Hi Bruno, Subtracting dates gives you a difference in days, not seconds.
>> now
== 24-Mar-2004/8:17:21-7:00
>> now - 1
== 23-Mar-2004/8:17:23-7:00 -- Gregg

### [5/6] from: maarten:vrijheid at: 24-Mar-2004 17:04

Hi Gabriele,
> GC> Bruno, it seems that you can't make the difference of a date/time with > GC> another greater. > GC> In the second example, the correct expression is test2 - test1 > > The problem actually is that SUBTRACT returns the number of days > between the two dates; so the result is correct. You have to use > DIFFERENCE if you want more precision. >
Or, using infix:
>> now/time
== 17:02:19 2 secs later:
>> now/time - 5
== 17:02:16 IIRC infix is a bit faster (at least it should be as infix ops are treated special by REBOL). --Maarten

### [6/6] from: nitsch-lists:netcologne at: 24-Mar-2004 17:22

On Mittwoch, 24. M=E4rz 2004 17:04, Maarten Koopmans wrote:
> Hi Gabriele, > > GC> Bruno, it seems that you can't make the difference of a date/time
<<quoted lines omitted: 10>>
> >> now/time - 5 > == 17:02:16
Problem is when you midnight in between, the result is completely wrong :) Thats why we have difference now.
> IIRC infix is a bit faster (at least it should be as infix ops are > treated special by REBOL). > > --Maarten
-Volker

Notes
• Quoted lines have been omitted from some messages.
View the message alone to see the lines that have been omitted