@@ -96,7 +96,7 @@ pub fn run(self: *App, widget: vxfw.Widget, opts: Options) anyerror!void {
9696 defer focus_handler .deinit (self .allocator );
9797
9898 // Timestamp of our next frame
99- var next_frame = std .Io .Timestamp .now (self .io , .real );
99+ var next_frame = std .Io .Timestamp .now (self .io , .awake );
100100
101101 // Create our event context
102102 var ctx : vxfw.EventContext = .{
@@ -111,14 +111,14 @@ pub fn run(self: *App, widget: vxfw.Widget, opts: Options) anyerror!void {
111111 defer ctx .cmds .deinit (self .allocator );
112112
113113 while (true ) {
114- const now = std .Io .Timestamp .now (self .io , .real );
114+ const now = std .Io .Timestamp .now (self .io , .awake );
115115 const duration = now .durationTo (next_frame );
116116 if (duration .nanoseconds <= 0 ) {
117117 // Deadline exceeded. Schedule the next frame
118118 next_frame = now .addDuration (tick );
119119 } else {
120120 // Sleep until the deadline
121- try self .io .sleep (duration , .real );
121+ try self .io .sleep (duration , .awake );
122122 next_frame = next_frame .addDuration (tick );
123123 }
124124
@@ -297,13 +297,13 @@ fn handleCommand(self: *App, cmds: *vxfw.CommandList) Allocator.Error!void {
297297}
298298
299299fn checkTimers (self : * App , ctx : * vxfw.EventContext ) anyerror ! void {
300- const now : std.Io.Timestamp = .now (self .io , .real );
300+ const now : std.Io.Timestamp = .now (self .io , .awake );
301301
302302 // timers are always sorted descending
303303 while (self .timers .pop ()) | tick | {
304304 const duration = now .durationTo (tick .deadline );
305- if (duration .nanoseconds < 0 ) {
306- // re-add the timer
305+ if (duration .nanoseconds > 0 ) {
306+ // re-add the timer as no more timers will trigger now
307307 try self .timers .append (self .allocator , tick );
308308 break ;
309309 }
0 commit comments