mirror of
https://github.com/EFForg/rayhunter.git
synced 2026-06-19 19:06:13 -07:00
Remove wrong timestamp correction from diag
This commit is contained in:
committed by
Will Greenberg
parent
fd63210bf9
commit
2781b3c7ed
@@ -191,10 +191,15 @@ pub struct SetTimeOffsetRequest {
|
||||
}
|
||||
|
||||
pub async fn get_time() -> Json<TimeResponse> {
|
||||
let system_time = Local::now();
|
||||
let adjusted_time = rayhunter::clock::get_adjusted_now();
|
||||
let offset_seconds = adjusted_time
|
||||
.signed_duration_since(system_time)
|
||||
.num_seconds();
|
||||
Json(TimeResponse {
|
||||
system_time: Local::now(),
|
||||
adjusted_time: rayhunter::clock::get_adjusted_now(),
|
||||
offset_seconds: rayhunter::clock::get_offset().num_seconds(),
|
||||
system_time,
|
||||
adjusted_time,
|
||||
offset_seconds,
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -10,7 +10,7 @@ use std::sync::RwLock;
|
||||
static CLOCK_OFFSET: RwLock<TimeDelta> = RwLock::new(TimeDelta::zero());
|
||||
|
||||
/// Get the current clock offset.
|
||||
pub fn get_offset() -> TimeDelta {
|
||||
fn get_offset() -> TimeDelta {
|
||||
*CLOCK_OFFSET.read().unwrap()
|
||||
}
|
||||
|
||||
|
||||
+1
-2
@@ -360,8 +360,7 @@ impl Timestamp {
|
||||
let mut delta_seconds = ts_upper as f64 * 1.25;
|
||||
delta_seconds += ts_lower as f64 / 40960.0;
|
||||
let ts_delta = chrono::Duration::milliseconds(delta_seconds as i64);
|
||||
// Apply global clock offset to adjust for incorrect device time
|
||||
epoch + ts_delta + crate::clock::get_offset()
|
||||
epoch + ts_delta
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user