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