fix millis vs seconds bug in hosted mode

This commit is contained in:
bunnie 2022-03-28 15:39:42 +08:00
parent bd78ba94f1
commit 2da52a1d5c
2 changed files with 3 additions and 3 deletions

View file

@ -561,7 +561,7 @@ fn xmain() -> ! {
Some(Opcode::GetRtcValue) => msg_blocking_scalar_unpack!(msg, _, _, _, _, {
use chrono::prelude::*;
let now = Local::now();
let total_secs = now.timestamp_millis() - 148409348; // sets the offset to something like 1974, which is roughly where an RTC value ends up in reality
let total_secs = now.timestamp_millis() / 1000 - 148409348; // sets the offset to something like 1974, which is roughly where an RTC value ends up in reality
xous::return_scalar2(msg.sender,
((total_secs >> 32) & 0xFFFF_FFFF) as usize,
(total_secs & 0xFFFF_FFFF) as usize,

View file

@ -219,8 +219,8 @@ pub fn start_time_server() {
if tz_key.read(&mut tz_buf).unwrap_or(0) == 8 {
tz_offset_ms = i64::from_le_bytes(tz_buf);
}
log::debug!("offset_key: {}", utc_offset_ms);
log::debug!("tz_key: {}", tz_offset_ms);
log::debug!("offset_key: {}", utc_offset_ms / 1000);
log::debug!("tz_key: {}", tz_offset_ms / 1000);
log::debug!("start_rtc_secs: {}", start_rtc_secs);
log::debug!("start_tt_ms: {}", start_tt_ms);
loop {