File tree Expand file tree Collapse file tree 2 files changed +6
-2
lines changed Expand file tree Collapse file tree 2 files changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -249,7 +249,9 @@ impl AnimationDriver {
249
249
/// Iterates through all animations based on the new time tick and updates their state. This should be called by
250
250
/// the windowing system driver for every frame.
251
251
pub fn update_animations ( & self , new_tick : Instant ) {
252
- if self . global_instant . as_ref ( ) . get_untracked ( ) != new_tick {
252
+ let current_tick = self . global_instant . as_ref ( ) . get_untracked ( ) ;
253
+ assert ! ( current_tick <= new_tick, "The platform's clock is not monotonic!" ) ;
254
+ if current_tick != new_tick {
253
255
self . active_animations . set ( false ) ;
254
256
self . global_instant . as_ref ( ) . set ( new_tick) ;
255
257
}
Original file line number Diff line number Diff line change @@ -94,7 +94,9 @@ pub trait Platform {
94
94
#[ cfg( feature = "std" ) ]
95
95
{
96
96
let the_beginning = * INITIAL_INSTANT . get_or_init ( time:: Instant :: now) ;
97
- time:: Instant :: now ( ) - the_beginning
97
+ let now = time:: Instant :: now ( ) ;
98
+ assert ! ( now >= the_beginning, "The platform's clock is not monotonic!" ) ;
99
+ now - the_beginning
98
100
}
99
101
#[ cfg( not( feature = "std" ) ) ]
100
102
unimplemented ! ( "The platform abstraction must implement `duration_since_start`" )
You can’t perform that action at this time.
0 commit comments