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 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'jefs.fs') 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 {{{ -- cgit v1.2.3