We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 98b6099 commit b40fc70Copy full SHA for b40fc70
lib/std/time.zig
@@ -73,6 +73,15 @@ pub fn milliTimestamp() i64 {
73
return @intCast(i64, @divFloor(nanoTimestamp(), ns_per_ms));
74
}
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
+
85
/// Get a calendar timestamp, in nanoseconds, relative to UTC 1970-01-01.
86
/// Precision of timing depends on the hardware and operating system.
87
/// On Windows this has a maximum granularity of 100 nanoseconds.
0 commit comments