From ea0c00411656872dcce0cf7bf124457dd0e45720 Mon Sep 17 00:00:00 2001 From: kitty Date: Tue, 10 Mar 2026 02:01:43 +1100 Subject: clock_gettime i was gonna add time&date but i have no clue how to approach calculating the date --- jefs.fs | 12 +++++++++--- readme.md | 1 - 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/jefs.fs b/jefs.fs index d8fce50..e8dfd99 100644 --- a/jefs.fs +++ b/jefs.fs @@ -445,18 +445,24 @@ make old-termios old-termios# allot \ TIME {{{ : nanosleep 35 syscall2 ; +: clock_gettime 228 syscall2 ; + +0 constant CLOCK_REALTIME 1 constant CLOCK_MONOTONIC +7 constant CLOCK_BOOTTIME 16 constant timespec# make timespec timespec# allot -: timespec.tv_sec timespec ; -: timespec.tv_nsec timespec 8 + ; +: timespec.tv_sec ; +: timespec.tv_nsec 8 + ; : ms>ns ( u -- u' ) 1000000 * ; : ns>ms ( u -- u' ) 1000000 / ; : ms>sec ( u -- ms sec ) 1000 /mod ; -: ms ( u -- ) ms>sec timespec.tv_sec ! ms>ns timespec.tv_nsec ! 0 timespec nanosleep errno .errno ; +: ms ( u -- ) ms>sec timespec timespec.tv_sec ! + ms>ns timespec timespec.tv_nsec ! + 0 timespec nanosleep errno .errno ; \ }}} \ DUMP {{{ diff --git a/readme.md b/readme.md index b0f33e8..4b9a52f 100644 --- a/readme.md +++ b/readme.md @@ -59,7 +59,6 @@ the error codes are: ## TODO - testing -- `DEPTH` - more terminal control words - `s\"` - `DO` + `LOOP` -- cgit v1.2.3