use crate::Time;
impl Time {
pub fn is_set(&self) -> bool {
*self != Self::default()
}
}
#[derive(PartialEq, Eq, Debug, Hash, Ord, PartialOrd, Clone, Copy)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
#[allow(missing_docs)]
pub enum Sign {
Plus,
Minus,
}
#[derive(Debug, Clone, Copy)]
pub enum Format {
Custom(CustomFormat),
Unix,
Raw,
}
#[derive(Clone, Copy, Debug)]
pub struct CustomFormat(pub(crate) &'static str);
impl CustomFormat {
pub const fn new(format: &'static str) -> Self {
Self(format)
}
}
impl From<CustomFormat> for Format {
fn from(custom_format: CustomFormat) -> Format {
Format::Custom(custom_format)
}
}
pub mod format;
mod init;
mod write;
mod sign {
use crate::time::Sign;
impl From<i32> for Sign {
fn from(v: i32) -> Self {
if v < 0 {
Sign::Minus
} else {
Sign::Plus
}
}
}
}
mod impls {
use crate::{time::Sign, Time};
impl Default for Time {
fn default() -> Self {
Time {
seconds: 0,
offset: 0,
sign: Sign::Plus,
}
}
}
}