Compare commits

...

2 commits

Author SHA1 Message Date
Mathieu Trossevin cfac28272b Merge branch 'main' into notify_barrier 2024-01-05 22:41:13 +01:00
Mathieu Trossevin f5b9796a32 fix(notify): WatchdogUsec and ExtendTimeoutUsec are in microseconds 2024-01-05 22:33:53 +01:00
2 changed files with 10 additions and 9 deletions

View file

@ -349,11 +349,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> {

View file

@ -86,22 +86,23 @@ impl Display for StatusLine<'_> {
}
}
/// Semantic type representing a number of microseconds.
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub struct Milliseconds(u64);
pub struct Microseconds(u64);
impl From<u64> for Milliseconds {
impl From<u64> for Microseconds {
fn from(value: u64) -> Self {
Self(value)
}
}
impl From<Milliseconds> for u64 {
fn from(value: Milliseconds) -> Self {
impl From<Microseconds> for u64 {
fn from(value: Microseconds) -> Self {
value.0
}
}
impl Display for Milliseconds {
impl Display for Microseconds {
#[inline]
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
Display::fmt(&self.0, f)