Move examples/*.sx and their expected/ snapshots into per-category subfolders (examples/<category>/...). Folder = leading filename token, with ffi-objc/ffi-jni kept whole; filenames are unchanged. The corpus runner and LSP sweep now discover each category's expected/ dir, while issues/ stays flat. Example 1058's repo-root-relative companion import is made file-relative. Path strings embedded in 164 snapshots were regenerated (path-only changes). Test-layout docs in CLAUDE.md updated.
36 lines
1006 B
Plaintext
36 lines
1006 B
Plaintext
// std.time (PLAN-HTTPZ S1): the wall clock reads a plausible epoch and
|
|
// the monotonic clock advances and never runs backwards. The `time`
|
|
// alias rides the std.sx namespace tail like its siblings.
|
|
#import "modules/std.sx";
|
|
|
|
main :: () -> i32 {
|
|
now := time.now_secs();
|
|
if now < 1767225600 { // before 2026-01-01: implausible
|
|
print("wall clock implausibly old: {}\n", now);
|
|
return 1;
|
|
}
|
|
if now > 4102444800 { // after 2100-01-01: implausible
|
|
print("wall clock implausibly far: {}\n", now);
|
|
return 1;
|
|
}
|
|
|
|
a := time.mono_ms();
|
|
b := a;
|
|
spins := 0;
|
|
while b == a and spins < 100000000 { // a real ms tick arrives long before the bound
|
|
b = time.mono_ms();
|
|
spins += 1;
|
|
}
|
|
if b < a {
|
|
print("monotonic went backwards: {} -> {}\n", a, b);
|
|
return 1;
|
|
}
|
|
if b == a {
|
|
print("monotonic never advanced\n");
|
|
return 1;
|
|
}
|
|
|
|
print("std.time ok\n");
|
|
return 0;
|
|
}
|