File tree Expand file tree Collapse file tree 2 files changed +11
-3
lines changed Expand file tree Collapse file tree 2 files changed +11
-3
lines changed Original file line number Diff line number Diff line change @@ -112,10 +112,18 @@ export class TimeClient {
112
112
// That's annoying -- time is not marching forward... let's fake it until it does.
113
113
t = new Date ( last . valueOf ( ) + 1 ) ;
114
114
}
115
- if ( this . clock_skew_ms ) {
116
- // We have synced the clock once successfully, so we now ensure the time is increasing.
115
+ if (
116
+ this . last_pong != null &&
117
+ Date . now ( ) - this . last_pong . local . valueOf ( ) < 5 * this . ping_interval_ms
118
+ ) {
119
+ // We have synced the clock **recently successfully**, so
120
+ // we now ensure the time is increasing.
117
121
// This first sync should happen with ms of the user connecting.
122
+ // We do NOT trust if the sync was a long time ago, e.g., due to
123
+ // a long network outage or laptop suspend/resume.
118
124
this . last_server_time = t ;
125
+ } else {
126
+ delete this . last_server_time ;
119
127
}
120
128
return t ;
121
129
}
Original file line number Diff line number Diff line change 1
1
/* autogenerated by the update_version script */
2
- exports . version = 1727277632 ;
2
+ exports . version = 1727734946 ;
You can’t perform that action at this time.
0 commit comments