diff --git a/src/notify/mod.rs b/src/notify/mod.rs index 1803b21..557ae93 100644 --- a/src/notify/mod.rs +++ b/src/notify/mod.rs @@ -230,11 +230,11 @@ pub enum NotifyState<'a> { /// Tell the service manager to execute the configured watchdog option. WatchdogTrigger, /// Reset watchdog timeout value during runtime. - /// The value is in milliseconds. - WatchdogUsec(types::Milliseconds), + /// The value is in microseconds. + WatchdogUsec(types::Microseconds), /// Tells the service manager to extend the startup, runtime or shutdown service timeout corresponding the current state. - /// The value is in milliseconds. - ExtendTimeoutUsec(types::Milliseconds), + /// The value is in microseconds. + ExtendTimeoutUsec(types::Microseconds), } impl<'a> Display for NotifyState<'a> { @@ -254,10 +254,10 @@ impl<'a> Display for NotifyState<'a> { NotifyState::Stopping => f.write_str("STOPPING=1"), NotifyState::Watchdog => f.write_str("WATCHDOG=1"), NotifyState::WatchdogTrigger => f.write_str("WATCHDOG=trigger"), - NotifyState::WatchdogUsec(types::Milliseconds(milliseconds)) => { + NotifyState::WatchdogUsec(types::Microseconds(milliseconds)) => { write!(f, "WATCHDOG_USEC={milliseconds}") } - NotifyState::ExtendTimeoutUsec(types::Milliseconds(milliseconds)) => { + NotifyState::ExtendTimeoutUsec(types::Microseconds(milliseconds)) => { write!(f, "EXTEND_TIMEOUT_USEC={milliseconds}") } } diff --git a/src/notify/types.rs b/src/notify/types.rs index cd5392b..d260d16 100644 --- a/src/notify/types.rs +++ b/src/notify/types.rs @@ -70,16 +70,17 @@ impl AsRef for StatusLine<'_> { } } +/// Semantic type representing a number of microseconds. #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] -pub struct Milliseconds(pub(super) u64); +pub struct Microseconds(pub(super) u64); -impl From for Milliseconds { +impl From for Microseconds { fn from(value: u64) -> Self { Self(value) } } -impl AsRef for Milliseconds { +impl AsRef for Microseconds { fn as_ref(&self) -> &u64 { &self.0 }