[REBOL] Re: A question in time saves... Clouds???
From: carl:cybercraft at: 5-Jun-2001 22:56
On 05-Jun-01, Tesselator wrote:
> Ah! yes.. thankyou, I see it.
> I kinda remember that now too.
> 00:00:00 = HH:MM:SS = Timer
> 00:00 = HH:MM = Time of day
> 0 = S = Timer in seconds
> Thanks for that! Now you wouldn't happen to know how to
> put many "Time of day" strings in a data block would you?
> I need the wait command to hold execution until specific
> times of day. Like a chime every 30 minutes at
> exactly 1:00, 1:30, 2:00, 2:30, etc.
> Can I just do:
> wait [12:00, 12:30, 13:00, 13:30, 14:00, 14:30,
> 15:00, 15:30, 16:00, 16:30, 17:00, 17:30,
> 18:00, 18:30, 19:00, 19:30, 20:00, 20:30,
> 21:00, 21:30, 22:00, 23:30, 00:00, 00:30,
> 01:00]
> in a loop?
Ahah - I think the email I've just sent may be of use. (: Instead of
using wait in the example I gave, use Graham's wait-till function
instead. Something like this...
times: [12:00 12:30 13:00 13:30] ; etc...
forever [
; Main code here
wait-till first times
print first times
times: next times
if empty? times [times: head times]
]
The 'first gets the first value in the block, 'next moves the block's
index along, and when the block seems empty, (it's not really - it's
just that its ('times's, actually) index is pointing at its end), the
'head word returns the block back to its original state.
> Graham Chiu wrote:
>>> and what does a time string look like? I could find
>>> wait 100 which
>>> is no. of seconds and I was shown wait 10:20:30,
>>> HH:MM:SS. How about
>>> a specific time like 11:32 PM ?
>>
>>
>>
>> I wrote this a couple of years ago:
>>
>> wait-till: func [ o'clock ] [
>> either now/time < o'clock [
>> wait ( o'clock - now/time )
>> ][
>> wait ( 24:00 - now/time + o'clock )
>> ]
>> ]
>>
>> eg:
>>
>> wait-till 2:00 ; wait till 2 AM.
>>
>> --
>> Graham Chiu
--
Carl Read
[carl--cybercraft--co--nz]