mirror of
https://github.com/saymrwulf/xous-core.git
synced 2026-11-18 08:52:45 +00:00
fix millis vs seconds bug in hosted mode
This commit is contained in:
parent
bd78ba94f1
commit
2da52a1d5c
2 changed files with 3 additions and 3 deletions
|
|
@ -561,7 +561,7 @@ fn xmain() -> ! {
|
||||||
Some(Opcode::GetRtcValue) => msg_blocking_scalar_unpack!(msg, _, _, _, _, {
|
Some(Opcode::GetRtcValue) => msg_blocking_scalar_unpack!(msg, _, _, _, _, {
|
||||||
use chrono::prelude::*;
|
use chrono::prelude::*;
|
||||||
let now = Local::now();
|
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,
|
xous::return_scalar2(msg.sender,
|
||||||
((total_secs >> 32) & 0xFFFF_FFFF) as usize,
|
((total_secs >> 32) & 0xFFFF_FFFF) as usize,
|
||||||
(total_secs & 0xFFFF_FFFF) as usize,
|
(total_secs & 0xFFFF_FFFF) as usize,
|
||||||
|
|
|
||||||
|
|
@ -219,8 +219,8 @@ pub fn start_time_server() {
|
||||||
if tz_key.read(&mut tz_buf).unwrap_or(0) == 8 {
|
if tz_key.read(&mut tz_buf).unwrap_or(0) == 8 {
|
||||||
tz_offset_ms = i64::from_le_bytes(tz_buf);
|
tz_offset_ms = i64::from_le_bytes(tz_buf);
|
||||||
}
|
}
|
||||||
log::debug!("offset_key: {}", utc_offset_ms);
|
log::debug!("offset_key: {}", utc_offset_ms / 1000);
|
||||||
log::debug!("tz_key: {}", tz_offset_ms);
|
log::debug!("tz_key: {}", tz_offset_ms / 1000);
|
||||||
log::debug!("start_rtc_secs: {}", start_rtc_secs);
|
log::debug!("start_rtc_secs: {}", start_rtc_secs);
|
||||||
log::debug!("start_tt_ms: {}", start_tt_ms);
|
log::debug!("start_tt_ms: {}", start_tt_ms);
|
||||||
loop {
|
loop {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue