| ... | ... | @@ -73,6 +73,15 @@ pub fn milliTimestamp() i64 { |
| 73 | 73 | return @intCast(i64, @divFloor(nanoTimestamp(), ns_per_ms)); |
| 74 | 74 | } |
| 75 | 75 | |
| 76 | /// Get a calendar timestamp, in microseconds, relative to UTC 1970-01-01. |
| 77 | /// Precision of timing depends on the hardware and operating system. |
| 78 | /// The return value is signed because it is possible to have a date that is |
| 79 | /// before the epoch. |
| 80 | /// See `std.os.clock_gettime` for a POSIX timestamp. |
| 81 | pub fn microTimestamp() i64 { |
| 82 | return @intCast(i64, @divFloor(nanoTimestamp(), ns_per_us)); |
| 83 | } |
| 84 | |
| 76 | 85 | /// Get a calendar timestamp, in nanoseconds, relative to UTC 1970-01-01. |
| 77 | 86 | /// Precision of timing depends on the hardware and operating system. |
| 78 | 87 | /// On Windows this has a maximum granularity of 100 nanoseconds. |