I would think that /Core really needs to return the
known subsecond value when now/time is called.
RT obviously recognized the need because they allow you
to represent times down to the nanosecond (look at the
time! datatype description in users guide) and it seems
restrictive to me to not allow now/time to return the
nanoseconds part of the time.

The only issue here is that every OS is different and some
don't allow subsecond timing and most only allow millisecond
timing.  Plus the time functions for each OS are different if
you want this subsecond info.  But it is possible to handle it.

Once /Command comes out you will be able to write your own function
to do this - but then you'll be stuck with the OS you choose to write
it for so I really hope RT puts this in /Core.  There really is no
good way to hack around it.

Rodney Snell


-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]]
Sent: Monday, June 19, 2000 4:26 PM
To: [EMAIL PROTECTED]
Subject: [REBOL] teeny-bits-of-time/2


In my quest to count teeny bits of time in REBOL, I created the following 
counting expression which makes note of how high REBOL can count in 
increments of 1 within a single second.

forever [ t: now
              c: 1
              while [ now = t ][ c: c + 1 ]
              print c
              append b c
              c: copy []
]

Of course, the results are entirely dependent upon the computer system you 
are using and how many other tasks the computer may be processing at the 
moment. Here are the results of running the expression on an Intel Celeron 
333MHz workstation running Windows NT 4 (bear in mind the first number 
returned is the remaining number of times the expression can count from 1 
within the second the expression begins):

2498
37594
37261
37103
37313
37555
37551
37274
37472
37563
37195
37539
37556
37496
37579
37386
37540
37108
>>

I guess this is a REBOL benchmarking expression of sorts.

If you could run this expression continuously while running other REBOL 
scripts--and if you could call the count from within the expression using 
another REBOL script running in parallel--you could create a fraction of a 
second based on the average count total during a specified period of time.

For example, you call 'c from the expression when 'c = 2000. Perhaps the 
average number of counts during the previous 10 seconds was 37,501 counts 
per second. Then the fraction would be .053331 seconds. REBOL could 
return a special 'now of

>> now
== 19-Jun-2000/18:20:44.053331-5:00

or

>> current-time: now/time
== 18:20:44.053331-5:00

Then you have your milliseconds, microseconds, and nanoseconds as 
follows:

>> print current-time/second
44
>> print current-time/millisecond
5
>> print current-time/microsecond
33
>> print current-time/nanosecond
31

Of course, this is a very imprecise way of measuring sub-second intervals in

REBOL.

Any suggestions on how this might be implemented?

-Ryan

Reply via email to