Initial commit
This commit is contained in:
commit
75a589f235
43 changed files with 4840 additions and 0 deletions
23
src/time/tz.rs
Normal file
23
src/time/tz.rs
Normal file
|
@ -0,0 +1,23 @@
|
|||
//! # Timezones
|
||||
//!
|
||||
//! Timezone utilities.
|
||||
|
||||
use crate::{data, time::Hours};
|
||||
|
||||
#[data(ord, copy, crate = crate)]
|
||||
pub struct FixedOffset(Hours);
|
||||
|
||||
impl FixedOffset {
|
||||
/// UTC time offset. Basically no offset.
|
||||
pub const UTC: Self = Self(Hours::new(0).unwrap());
|
||||
|
||||
/// Make offset from hours.
|
||||
pub const fn from_hours(hours: Hours) -> Self {
|
||||
Self(hours)
|
||||
}
|
||||
|
||||
/// Get offset in hours.
|
||||
pub const fn hours(self) -> Hours {
|
||||
self.0
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue