| ... | @@ -10858,14 +10858,15 @@ fn clockResolution(userdata: ?*anyopaque, clock: Io.Clock) Io.Clock.ResolutionEr | ... | @@ -10858,14 +10858,15 @@ fn clockResolution(userdata: ?*anyopaque, clock: Io.Clock) Io.Clock.ResolutionEr |
| 10858 | const result = scale >> 32; | 10858 | const result = scale >> 32; |
| 10859 | return .fromNanoseconds(result); | 10859 | return .fromNanoseconds(result); |
| 10860 | }, | 10860 | }, |
| 10861 | .cpu_process, .cpu_thread => return .zero, | 10861 | .cpu_process, .cpu_thread => return error.ClockUnavailable, |
| 10862 | }, | 10862 | }, |
| 10863 | .wasi => { | 10863 | .wasi => { |
| 10864 | if (builtin.link_libc) return clockResolutionPosix(clock); | 10864 | if (builtin.link_libc) return clockResolutionPosix(clock); |
| 10865 | var ns: std.os.wasi.timestamp_t = undefined; | 10865 | var ns: std.os.wasi.timestamp_t = undefined; |
| 10866 | return switch (std.os.wasi.clock_res_get(clockToWasi(clock), &ns)) { | 10866 | return switch (std.os.wasi.clock_res_get(clockToWasi(clock), &ns)) { |
| 10867 | .SUCCESS => .fromNanoseconds(ns), | 10867 | .SUCCESS => .fromNanoseconds(ns), |
| 10868 | else => .zero, | 10868 | .INVAL => return error.ClockUnavailable, |
| | 10869 | else => |err| return posix.unexpectedErrno(err), |
| 10869 | }; | 10870 | }; |
| 10870 | }, | 10871 | }, |
| 10871 | else => return clockResolutionPosix(clock), | 10872 | else => return clockResolutionPosix(clock), |
| ... | @@ -10877,7 +10878,8 @@ fn clockResolutionPosix(clock: Io.Clock) Io.Clock.ResolutionError!Io.Duration { | ... | @@ -10877,7 +10878,8 @@ fn clockResolutionPosix(clock: Io.Clock) Io.Clock.ResolutionError!Io.Duration { |
| 10877 | var timespec: posix.timespec = undefined; | 10878 | var timespec: posix.timespec = undefined; |
| 10878 | return switch (posix.errno(posix.system.clock_getres(clock_id, &timespec))) { | 10879 | return switch (posix.errno(posix.system.clock_getres(clock_id, &timespec))) { |
| 10879 | .SUCCESS => .fromNanoseconds(nanosecondsFromPosix(&timespec)), | 10880 | .SUCCESS => .fromNanoseconds(nanosecondsFromPosix(&timespec)), |
| 10880 | else => .zero, | 10881 | .INVAL => return error.ClockUnavailable, |
| | 10882 | else => |err| return posix.unexpectedErrno(err), |
| 10881 | }; | 10883 | }; |
| 10882 | } | 10884 | } |
| 10883 | | 10885 | |