Hojun-Cho 7e9bede6c5 lib/time+test: add types, ops, now
Replaces the lib/time placeholder (a monotonic(*timespec) shim that
predated lib/os's syscall surface). Ships Hare's time module first
cut per ref/hare/time/{duration,instant,arithm,+linux/functions}.ha:

- duration (i64 ns); nanosecond / microsecond / millisecond / second
  constants.
- instant (sec, nsec) — Hare's layout, NOT POSIX's nsec:u32. Matches
  Linux struct timespec on 64-bit, so &instant lands directly in
  clock_gettime.
- clock enum: realtime + monotonic only. The rest of Hare's set
  (process_cpu / thread_cpu / boot / realtime_alarm / boot_alarm / tai)
  graduates when a caller actually needs it (rule 9).
- now(c: clock) instant — aborts on EINVAL/EFAULT (mirrors Hare's
  abort-on-impossible-errno). Deliberately NOT (instant | oserror) to
  sidestep task #9's 1-word-payload tagged-return trap.
- add / diff / compare on instants per ref/hare/time/arithm.ha
  verbatim.

Deferred to follow-up commits when a caller surfaces: sleep, format /
strftime, time.chrono / time.date calendar, timezone, time.error
sum-return shape, time.unix helpers, time.mult, conversion helpers.

Tests at lib/time/timetest.ww (15 rows, table-pattern, semantic per
Class B doctrine). Driver test/wcc/977_time_run.c slotted between
976_stat_run and 978_intdiv_signed in the 9xx _run band.
examples/cmatrix migrates to the new API in the same commit (sole
pre-existing caller — bisect-clean per rule 11).

Class B bug #16 (sign-extend before IDIVQ) was surfaced by the
negative-duration rows during this work; landed 63332fe..4fa4bcf
before this commit. Rows 8-9 (addneg_noborrow / addneg_borrow) are
the load-bearing Class B exercisers; would have stayed silently wrong
pre-#16.

lib/time's own .s output has a cstage/wwstage label-counter skew in
add (cstage emits add_ct_7/_ce_8/_end_6 vs wwstage _6/_7/_5). Filed
as task #15; non-bootstrap-blocking since lib/time is outside the
selfhost toolchain transitive chain.
2026-05-17 02:51:15 +09:00
2026-05-17 02:51:15 +09:00
2026-05-10 01:24:58 +09:00
2026-05-17 02:51:15 +09:00
2026-05-17 02:51:15 +09:00
Description
No description provided
12 MiB
Languages
C 89.4%
Python 7.2%
Makefile 2.3%
Shell 0.8%
Assembly 0.3%