use std::time::SystemTime for uptime calculation

std::time::Instant does not count eg. doze-time on android
This commit is contained in:
B. Petersen
2020-04-26 11:19:37 +02:00
parent 39cb9c425c
commit 432e4b7f0a

View File

@@ -22,7 +22,7 @@ use crate::message::{self, Message, MessengerMessage, MsgId};
use crate::param::Params; use crate::param::Params;
use crate::smtp::Smtp; use crate::smtp::Smtp;
use crate::sql::Sql; use crate::sql::Sql;
use std::time::Instant; use std::time::SystemTime;
/// Callback function type for [Context] /// Callback function type for [Context]
/// ///
@@ -59,7 +59,7 @@ pub struct Context {
/// Mutex to avoid generating the key for the user more than once. /// Mutex to avoid generating the key for the user more than once.
pub generating_key_mutex: Mutex<()>, pub generating_key_mutex: Mutex<()>,
pub translated_stockstrings: RwLock<HashMap<usize, String>>, pub translated_stockstrings: RwLock<HashMap<usize, String>>,
creation_time: Instant, creation_time: SystemTime,
} }
#[derive(Debug, PartialEq, Eq)] #[derive(Debug, PartialEq, Eq)]
@@ -141,7 +141,7 @@ impl Context {
perform_inbox_jobs_needed: Arc::new(RwLock::new(false)), perform_inbox_jobs_needed: Arc::new(RwLock::new(false)),
generating_key_mutex: Mutex::new(()), generating_key_mutex: Mutex::new(()),
translated_stockstrings: RwLock::new(HashMap::new()), translated_stockstrings: RwLock::new(HashMap::new()),
creation_time: std::time::Instant::now(), creation_time: std::time::SystemTime::now(),
}; };
ensure!( ensure!(