futu_backend/auth/commconfig/clock.rs
1//! Server-time clock adapter for CommConfig runtime decisions.
2
3/// CommConfig timestamps use the same server-time basis as C++
4/// `INNBiz_SvrTime::GetSvrTimeStamp()`, not the daemon host clock alone.
5pub fn server_now_ts(svr_time_offset: i64) -> i64 {
6 server_now_ts_at(chrono::Utc::now().timestamp(), svr_time_offset)
7}
8
9pub fn server_now_ts_at(local_now_ts: i64, svr_time_offset: i64) -> i64 {
10 local_now_ts.saturating_add(svr_time_offset)
11}