aro: avoid asking for the time

this value should be calculated earlier and passed in
This commit is contained in:
Andrew Kelley 2025-10-18 02:29:59 -07:00
parent 43c2ba375d
commit 97b9cc0adf
2 changed files with 4 additions and 4 deletions

View file

@ -114,7 +114,7 @@ pub const Environment = struct {
if (parsed > max_timestamp) return error.InvalidEpoch; if (parsed > max_timestamp) return error.InvalidEpoch;
return .{ .provided = parsed }; return .{ .provided = parsed };
} else { } else {
const timestamp = std.math.cast(u64, std.time.timestamp()) orelse return error.InvalidEpoch; const timestamp = std.math.cast(u64, 0) orelse return error.InvalidEpoch;
return .{ .system = std.math.clamp(timestamp, 0, max_timestamp) }; return .{ .system = std.math.clamp(timestamp, 0, max_timestamp) };
} }
} }

View file

@ -273,6 +273,7 @@ pub fn parseArgs(
macro_buf: *std.ArrayList(u8), macro_buf: *std.ArrayList(u8),
args: []const []const u8, args: []const []const u8,
) (Compilation.Error || std.Io.Writer.Error)!bool { ) (Compilation.Error || std.Io.Writer.Error)!bool {
const io = d.comp.io;
var i: usize = 1; var i: usize = 1;
var comment_arg: []const u8 = ""; var comment_arg: []const u8 = "";
var hosted: ?bool = null; var hosted: ?bool = null;
@ -772,7 +773,7 @@ pub fn parseArgs(
opts.arch_os_abi, @errorName(e), opts.arch_os_abi, @errorName(e),
}), }),
}; };
d.comp.target = std.zig.system.resolveTargetQuery(query) catch |e| { d.comp.target = std.zig.system.resolveTargetQuery(io, query) catch |e| {
return d.fatal("unable to resolve target: {s}", .{errorDescription(e)}); return d.fatal("unable to resolve target: {s}", .{errorDescription(e)});
}; };
} }
@ -916,8 +917,7 @@ pub fn errorDescription(e: anyerror) []const u8 {
error.NotDir => "is not a directory", error.NotDir => "is not a directory",
error.NotOpenForReading => "file is not open for reading", error.NotOpenForReading => "file is not open for reading",
error.NotOpenForWriting => "file is not open for writing", error.NotOpenForWriting => "file is not open for writing",
error.InvalidUtf8 => "path is not valid UTF-8", error.BadPathName => "bad path name",
error.InvalidWtf8 => "path is not valid WTF-8",
error.FileBusy => "file is busy", error.FileBusy => "file is busy",
error.NameTooLong => "file name is too long", error.NameTooLong => "file name is too long",
error.AccessDenied => "access denied", error.AccessDenied => "access denied",