pub struct UtcOffset {
pub minutes: i16,
}Expand description
A UTC offset suitable for DateHourMin and DateTime precision tiers.
Stored as signed integer minutes from UTC in the range −1439..=+1439
(i.e. ±23:59). The maximum representable offset is ±23:59; offsets of
±24:00 or larger are rejected by UtcOffset::from_hhmm.
None in the parent type represents a floating (offset-naive) time.
§Examples
use marque_ism::date::UtcOffset;
let eastern = UtcOffset::from_hhmm(-1, 5, 0).unwrap(); // -05:00
assert_eq!(eastern.to_string(), "-05:00");
assert_eq!(UtcOffset::UTC.to_string(), "Z");Fields§
§minutes: i16Signed offset in minutes: +05:30 → 330, −07:00 → −420.
Implementations§
Source§impl UtcOffset
impl UtcOffset
Sourcepub fn from_hhmm(sign: i8, hours: u8, minutes: u8) -> Option<Self>
pub fn from_hhmm(sign: i8, hours: u8, minutes: u8) -> Option<Self>
Construct from a sign and hours/minutes.
sign must be 1 or -1. Returns None if components are out of
range (hours > 23, minutes > 59). The maximum representable
offset magnitude is 23:59 (1439 minutes).
Sourcepub fn to_seconds(self) -> i32
pub fn to_seconds(self) -> i32
Total offset in seconds (for jiff tz::Offset::from_seconds).
Trait Implementations§
Source§impl FromStr for UtcOffset
impl FromStr for UtcOffset
Source§fn from_str(s: &str) -> Result<Self, Self::Err>
fn from_str(s: &str) -> Result<Self, Self::Err>
Parse a standalone ISO 8601 UTC offset string.
Accepted forms:
"Z"→ UTC (zero offset)"+HH:MM"→ positive offset (e.g."+05:30")"-HH:MM"→ negative offset (e.g."-05:00")
Returns Err for any other form (e.g. "EST", "UTC", "+0530").