From b8e2677c0c71252e5ce90073c752c8a14869250d Mon Sep 17 00:00:00 2001 From: Dylan Conway Date: Thu, 1 May 2025 21:16:17 -0700 Subject: [PATCH] update --- src/bun.js/WTFTimer.zig | 4 ++-- src/bun.js/api/bun/dns_resolver.zig | 2 +- src/bun.js/test/jest.zig | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/bun.js/WTFTimer.zig b/src/bun.js/WTFTimer.zig index 5bacf9a63f..5fba12611a 100644 --- a/src/bun.js/WTFTimer.zig +++ b/src/bun.js/WTFTimer.zig @@ -50,7 +50,7 @@ pub fn update(this: *WTFTimer, seconds: f64, repeat: bool) void { } const modf = std.math.modf(seconds); - var interval: timespec = if (Environment.isWindows) .fromMs(uv.uv_now(this.vm.uvLoop())) else timespec.now(); + var interval = this.vm.now(); interval.sec += @intFromFloat(modf.ipart); interval.nsec += @intFromFloat(modf.fpart * std.time.ns_per_s); if (interval.nsec >= std.time.ns_per_s) { @@ -131,7 +131,7 @@ export fn WTFTimer__secondsUntilTimer(this: *WTFTimer) f64 { this.lock.lock(); defer this.lock.unlock(); if (this.event_loop_timer.state == .ACTIVE) { - const now: timespec = if (Environment.isWindows) .fromMs(uv.uv_now(this.vm.uvLoop())) else timespec.now(); + const now = this.vm.now(); const until = this.event_loop_timer.next.duration(&now); const sec: f64, const nsec: f64 = .{ @floatFromInt(until.sec), @floatFromInt(until.nsec) }; return sec + nsec / std.time.ns_per_s; diff --git a/src/bun.js/api/bun/dns_resolver.zig b/src/bun.js/api/bun/dns_resolver.zig index 276b23ac96..982bcf2fd6 100644 --- a/src/bun.js/api/bun/dns_resolver.zig +++ b/src/bun.js/api/bun/dns_resolver.zig @@ -1973,7 +1973,7 @@ pub const DNSResolver = struct { } this.ref(); - this.event_loop_timer.next = (now orelse ×pec.now()).addMs(1000); + this.event_loop_timer.next = (now orelse &this.vm.now()).addMs(1000); this.vm.timer.incrementTimerRef(1); this.vm.timer.insert(&this.event_loop_timer); return true; diff --git a/src/bun.js/test/jest.zig b/src/bun.js/test/jest.zig index d1d1023c59..26211afd8c 100644 --- a/src/bun.js/test/jest.zig +++ b/src/bun.js/test/jest.zig @@ -685,7 +685,7 @@ pub const TestScope = struct { debug("test({})", .{bun.fmt.QuotedFormatter{ .text = this.label }}); var initial_value = JSValue.zero; - task.started_at = bun.timespec.now(); + task.started_at = vm.now(); if (this.timeout_millis == std.math.maxInt(u32)) { if (Jest.runner.?.default_timeout_override != std.math.maxInt(u32)) {