diff options
| author | kitty <nepeta@canaglie.net> | 2026-03-10 02:01:43 +1100 |
|---|---|---|
| committer | kitty <nepeta@canaglie.net> | 2026-03-10 02:01:43 +1100 |
| commit | ea0c00411656872dcce0cf7bf124457dd0e45720 (patch) | |
| tree | e9f19b06927130f8bc8a1fdc9ad0dedfcb7ed9d5 | |
| parent | 0987d769fef46c8d2780eacbddaba63aae9e8ba4 (diff) | |
clock_gettime
i was gonna add time&date but i have no clue how to approach calculating
the date
| -rw-r--r-- | jefs.fs | 12 | ||||
| -rw-r--r-- | readme.md | 1 |
2 files changed, 9 insertions, 4 deletions
@@ -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 {{{ @@ -59,7 +59,6 @@ the error codes are: ## TODO - testing -- `DEPTH` - more terminal control words - `s\"` - `DO` + `LOOP` |
