| ... | ... | @@ -152,7 +152,7 @@ pub const Timer = struct { |
| 152 | 152 | // impossible here barring cosmic rays or other such occurances of |
| 153 | 153 | // incredibly bad luck. |
| 154 | 154 | //On Darwin: This cannot fail, as far as I am able to tell. |
| 155 | | const TimerError = error{TimerUnsupported, UnexpectedErrnoValue}; |
| 155 | const TimerError = error{TimerUnsupported, Unexpected}; |
| 156 | 156 | pub fn start() TimerError!Timer { |
| 157 | 157 | var self: Timer = undefined; |
| 158 | 158 | |
| ... | ... | @@ -177,14 +177,17 @@ pub const Timer = struct { |
| 177 | 177 | // seccomp is going to block us it will at least do so consistently |
| 178 | 178 | var ts: posix.timespec = undefined; |
| 179 | 179 | var result = posix.clock_getres(monotonic_clock_id, &ts); |
| 180 | | switch (posix.getErrno(result)) { |
| 180 | var errno = posix.getErrno(result); |
| 181 | switch (errno) { |
| 181 | 182 | 0 => {}, |
| 182 | 183 | posix.EINVAL => return error.TimerUnsupported, |
| 183 | | else => return error.UnexpectedErrnoValue, |
| 184 | else => return std.os.unexpectedErrorPosix(errno), |
| 184 | 185 | } |
| 185 | 186 | self.resolution = u64(ts.tv_sec) * u64(ns_per_s) + u64(ts.tv_nsec); |
| 187 | |
| 186 | 188 | result = posix.clock_gettime(monotonic_clock_id, &ts); |
| 187 | | if (posix.getErrno(result) != 0) return error.UnexpectedErrnoValue; |
| 189 | errno = posix.getErrno(result); |
| 190 | if (errno != 0) return std.os.unexpectedErrorPosix(errno); |
| 188 | 191 | self.start_time = u64(ts.tv_sec) * u64(ns_per_s) + u64(ts.tv_nsec); |
| 189 | 192 | }, |
| 190 | 193 | Os.macosx, Os.ios => { |