nx_clock_full.nx
buildroot/runtime/nx_clock_full.nx
about
nx_clock.nx -- sovereign wall-clock + monotonic time primitive.
Replaces Python's time.perf_counter_ns() in bench harnesses. Calls
the Linux clock_gettime syscall directly via __syscall.
genealogy_id: posix_clock_gettime
lineage_id: function
dependencies 1 imports · 1 importers
imports: syscalls.nx
imported by: nx_clock_test.nx
structs
| 42 | struct NxTimespec |
consts
| 32 | const NX_SYS_CLOCK_GETTIME: i64 = 113 // Linux RISC-V syscall number |
| 33 | const NX_CLOCK_REALTIME: i64 = 0 // clock_gettime clockid: wall time |
| 34 | const NX_CLOCK_MONOTONIC: i64 = 1 // clock_gettime clockid: since-boot |
| 37 | const NX_NS_PER_SEC: i64 = 1000000000 // 1e9 nanoseconds per second |
| 38 | const NX_NS_PER_US: i64 = 1000 // 1e3 nanoseconds per microsecond |
| 39 | const NX_NS_PER_MS: i64 = 1000000 // 1e6 nanoseconds per millisecond |
functions
| 49 | func nx_clock_gettime(clock_id: i64) -> i64 |
| 58 | func nx_clock_realtime_ns() -> i64 |
| 62 | func nx_clock_monotonic_ns() -> i64 |
| 66 | func nx_clock_elapsed_us(start_ns: i64) -> i64 |
| 71 | func nx_clock_elapsed_ms(start_ns: i64) -> i64 |