mirror of
https://github.com/rustfs/rustfs.git
synced 2026-08-09 14:49:25 +00:00
refactor(runtime): wrap boot time global (#4044)
This commit is contained in:
@@ -186,10 +186,13 @@ pub(crate) async fn rustfs_addr() -> String {
|
||||
rustfs_common::get_global_addr().await
|
||||
}
|
||||
|
||||
pub fn boot_time() -> Option<SystemTime> {
|
||||
GLOBAL_BOOT_TIME.get().cloned()
|
||||
}
|
||||
|
||||
pub(crate) fn boot_uptime_secs() -> u64 {
|
||||
GLOBAL_BOOT_TIME
|
||||
.get()
|
||||
.and_then(|boot_time| SystemTime::now().duration_since(*boot_time).ok())
|
||||
boot_time()
|
||||
.and_then(|boot_time| SystemTime::now().duration_since(boot_time).ok())
|
||||
.unwrap_or_default()
|
||||
.as_secs()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user