mirror of
https://github.com/scottlamb/moonfire-nvr.git
synced 2025-11-20 01:50:24 -05:00
prep v0.7.19
This commit is contained in:
@@ -21,8 +21,11 @@ use crate::shutdown::ShutdownError;
|
||||
pub struct SystemTime(pub TimeSpec);
|
||||
|
||||
impl SystemTime {
|
||||
pub fn new(sec: nix::sys::time::time_t, nsec: i64) -> Self {
|
||||
SystemTime(TimeSpec::new(sec, nsec))
|
||||
pub fn new(sec: u64, nsec: i64) -> Self {
|
||||
// `TimeSpec::new`'s arguments vary by platform.
|
||||
// * currently uses 32-bit time_t on musl <https://github.com/rust-lang/libc/issues/1848>
|
||||
// * nsec likewise can vary.
|
||||
SystemTime(TimeSpec::new(sec as _, nsec as _))
|
||||
}
|
||||
|
||||
pub fn as_secs(&self) -> i64 {
|
||||
|
||||
@@ -161,7 +161,8 @@ impl Time {
|
||||
|
||||
impl From<SystemTime> for Time {
|
||||
fn from(tm: SystemTime) -> Self {
|
||||
Time(tm.0.tv_sec() * TIME_UNITS_PER_SEC + tm.0.tv_nsec() * 9 / 100_000)
|
||||
#[allow(clippy::unnecessary_cast)]
|
||||
Time((tm.0.tv_sec() as i64) * TIME_UNITS_PER_SEC + (tm.0.tv_nsec() as i64) * 9 / 100_000)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user