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