Made a few changes to the patch. Thank you Tarl for your suggestions.
Signed-Off-By: John Arbuckle programmingkidx@gmail.com
--- forth/system/main.fs | 22 ++++++++++++++++++++++ 1 files changed, 22 insertions(+), 0 deletions(-)
diff --git a/forth/system/main.fs b/forth/system/main.fs index 122ab1f..16d4829 100644 --- a/forth/system/main.fs +++ b/forth/system/main.fs @@ -58,3 +58,25 @@ variable DIAG-list
outer-interpreter ; + +\ Returns the time ( -- second minute hour day month year ) +: get-time + " rtc" open-dev ( device ) + dup ( device device ) + + 0= if \ if the real-time clock isn't available + drop ( ) + true ( flag ) + cr + abort" Sorry but get-time isn't available for your system. " + then + + " get-time" ( device addr len ) + rot ( addr len device ) + dup ( addr len device device ) + >r ( addr len device ) ( R: device ) + $call-method ( addr len device -- second minute hour day month year ) ( R: device ) + r> ( device ) ( R: ) + close-dev ( device -- ) +; +