2019-10-14 19:39:09 +02:00
|
|
|
# Time and Date
|
|
|
|
|
|
|
|
The `clock:` namespace contains words for interacting with the
|
|
|
|
system clock.
|
|
|
|
|
|
|
|
~~~
|
|
|
|
{{
|
2019-12-09 20:37:26 +01:00
|
|
|
'Clock var
|
2019-10-14 19:39:09 +02:00
|
|
|
:identify
|
2019-12-09 20:37:26 +01:00
|
|
|
@Clock n:zero? [
|
2019-10-14 19:39:09 +02:00
|
|
|
#5 io:scan-for dup n:negative?
|
|
|
|
[ drop 'IO_DEVICE_TYPE_0005_NOT_FOUND s:put nl ]
|
2019-12-09 20:37:26 +01:00
|
|
|
[ !Clock ] choose ] if ;
|
2019-10-14 19:39:09 +02:00
|
|
|
---reveal---
|
2019-12-09 20:37:26 +01:00
|
|
|
:io:clock-operation identify @Clock io:invoke ;
|
2019-10-14 19:39:09 +02:00
|
|
|
}}
|
|
|
|
|
2019-10-14 22:33:58 +02:00
|
|
|
: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 ;
|
2019-10-14 19:39:09 +02:00
|
|
|
~~~
|