retroforth/interface/io/clock.retro
crc 00586f3354 move interfaces to interface/
FossilOrigin-Name: 95a4793e965f0787a8664e4dc3a4f49f66098c30c2a209b6a6d7c2c5fb79193a
2019-11-21 19:48:05 +00:00

31 lines
996 B
Text

# Time and Date
The `clock:` namespace contains words for interacting with the
system clock.
~~~
{{
'io:ClockSyscall var
:identify
@io:ClockSyscall n:zero? [
#5 io:scan-for dup n:negative?
[ drop 'IO_DEVICE_TYPE_0005_NOT_FOUND s:put nl ]
[ !io:ClockSyscall ] choose ] if ;
---reveal---
:io:clock-operation identify @io:ClockSyscall io:invoke ;
}}
:clock:timestamp (-n) #0 io:clock-operation ;
:clock:day (-n) #1 io:clock-operation ;
:clock:month (-n) #2 io:clock-operation ;
:clock:year (-n) #3 io:clock-operation ;
:clock:hour (-n) #4 io:clock-operation ;
:clock:minute (-n) #5 io:clock-operation ;
:clock:second (-n) #6 io:clock-operation ;
:clock:utc:day (-n) #7 io:clock-operation ;
:clock:utc:month (-n) #8 io:clock-operation ;
:clock:utc:year (-n) #9 io:clock-operation ;
:clock:utc:hour (-n) #10 io:clock-operation ;
:clock:utc:minute (-n) #11 io:clock-operation ;
:clock:utc:second (-n) #12 io:clock-operation ;
~~~