mirror of
https://github.com/oven-sh/bun
synced 2026-02-09 10:28:47 +00:00
update
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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)) {
|
||||
|
||||
Reference in New Issue
Block a user