Hi Allen

Interesting. I think the largest time value for year which works in the
expected way is:

>> 596522:10:12            ;this is ok (and far beyond any reasonable year
value)
== 596522:10:12

>> 596523:10:12
** Syntax Error: Invalid time -- 596523:10:12.
** Where: (line 1) 596523:10:12

REBOL allows integers to be entered for the year which are larger than
allowed by the REBOL integer! datatype. This is probably not what was
intended. Also there are further anomalies.

>> to-time probe rejoin [2 ** 32 ":10:12"]      ;multiples of 2 ** 32
produce 0 for the year
"4294967296:10:12"
== 0:10:12

>> to-time probe rejoin [2 ** 32 + 1 ":10:12"]   ;we can add 1 and the year
increments
"4294967297:10:12"
== 1:10:12

>> to-time probe rejoin [2 ** 32 - 1 ":10:12"]   ;but if we subtract, big
surprise!
"4294967295:10:12"
== -0:49:48

The largest value for year which does not lead to an error for the 'rejoin
block is:

>> to-time probe rejoin [999999999999999 ":10:12"]
"999999999999999:10:12"
== 183645:36:20

This limitation is due to the way 'form works, if we enter a larger value
directly, we get

>> 1000000000000000:10:12
== 183646:36:20

The weird numbers are due to some sort of wrapping of the integer values.
The behavior is complex, so the explanation you requested will likely have
to come from someone at Rebol Tech with access to the underlying C-code.

One simple fix would be to return the "Invalid time" error for values of
year greater than 596522.

I am copying this to feedback as a bug. You, of course, deserve full credit
for the discovery. Good catch!

Cheers

Larry

----- Original Message -----
From: <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, March 09, 2000 4:44 AM
Subject: [REBOL] Weird stuff with time


> Whilst testing to find the upper limits of time/hour (for an up-time
> monitoring script)
> I came across these anomalies in time!
>
> Can anyone explain what is happening here?
> How come some large numbers for hours give an error and others
> return bizare numbers?
>
>  x: 2000:10:12
> == 2000:10:12
> >> x: 200000:10:12
> == 200000:10:12
> >> x: 2000000:10:12
> ** Syntax Error: Invalid time -- 2000000:10:12.
> ** Where: (line 1) x: 2000000:10:12
> >> x: 2000000:10:12
> ** Syntax Error: Invalid time -- 2000000:10:12.
> ** Where: (line 1) x: 2000000:10:12
> >> x: 20000000:10:12
> ** Syntax Error: Invalid time -- 20000000:10:12.
> ** Where: (line 1) x: 20000000:10:12
> >> x: 200000000:10:12
> ** Syntax Error: Invalid time -- 200000000:10:12.
> ** Where: (line 1) x: 200000000:10:12
> >> x: 2000000000:10:12
> ** Syntax Error: Invalid time -- 2000000000:10:12.
> ** Where: (line 1) x: 2000000000:10:12
> >> x: 20000000000:10:12
> == -231041:32:12
> >> x: 200000000000:10:12
> == 75676:02:44
> >> x: 2000000000000:10:12
> == -436287:32:44
> >> x: 20000000000000:10:12
> == 409308:53:56
>
> Cheers,
>
> Allen K
>

Reply via email to