(breaking) std.time fixups and API changes
Remove the constants that assume a base unit in favor of explicit x_per_y constants. nanosecond calendar timestamps now use i128 for the type. This affects fs.File.Stat, std.time.nanoTimestamp, and fs.File.updateTimes. calendar timestamps are now signed, because the value can be less than the epoch (the user can set their computer time to whatever they wish). implement std.os.clock_gettime for Windows when clock id is CLOCK_CALENDAR.
This commit is contained in:
@@ -31,10 +31,10 @@ pub const Progress = struct {
|
||||
output_buffer: [100]u8 = undefined,
|
||||
|
||||
/// How many nanoseconds between writing updates to the terminal.
|
||||
refresh_rate_ns: u64 = 50 * std.time.millisecond,
|
||||
refresh_rate_ns: u64 = 50 * std.time.ns_per_ms,
|
||||
|
||||
/// How many nanoseconds to keep the output hidden
|
||||
initial_delay_ns: u64 = 500 * std.time.millisecond,
|
||||
initial_delay_ns: u64 = 500 * std.time.ns_per_ms,
|
||||
|
||||
done: bool = true,
|
||||
|
||||
@@ -282,24 +282,24 @@ test "basic functionality" {
|
||||
next_sub_task = (next_sub_task + 1) % sub_task_names.len;
|
||||
|
||||
node.completeOne();
|
||||
std.time.sleep(5 * std.time.millisecond);
|
||||
std.time.sleep(5 * std.time.ns_per_ms);
|
||||
node.completeOne();
|
||||
node.completeOne();
|
||||
std.time.sleep(5 * std.time.millisecond);
|
||||
std.time.sleep(5 * std.time.ns_per_ms);
|
||||
node.completeOne();
|
||||
node.completeOne();
|
||||
std.time.sleep(5 * std.time.millisecond);
|
||||
std.time.sleep(5 * std.time.ns_per_ms);
|
||||
|
||||
node.end();
|
||||
|
||||
std.time.sleep(5 * std.time.millisecond);
|
||||
std.time.sleep(5 * std.time.ns_per_ms);
|
||||
}
|
||||
{
|
||||
var node = root_node.start("this is a really long name designed to activate the truncation code. let's find out if it works", null);
|
||||
node.activate();
|
||||
std.time.sleep(10 * std.time.millisecond);
|
||||
std.time.sleep(10 * std.time.ns_per_ms);
|
||||
progress.refresh();
|
||||
std.time.sleep(10 * std.time.millisecond);
|
||||
std.time.sleep(10 * std.time.ns_per_ms);
|
||||
node.end();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user