[][src]Macro time::offset

macro_rules! offset {
    #[proc_macro_hack] => { ... };
}

Construct a UtcOffset with a statically known value.

The resulting expression can be used in const or static declarations.

A sign and the hour must be provided; minutes and seconds default to zero. UTC (both uppercase and lowercase) is also allowed.

assert_eq!(offset!(UTC), UtcOffset::hours(0));
assert_eq!(offset!(utc), UtcOffset::hours(0));
assert_eq!(offset!(+0), UtcOffset::hours(0));
assert_eq!(offset!(+1), UtcOffset::hours(1));
assert_eq!(offset!(-1), UtcOffset::hours(-1));
assert_eq!(offset!(+1:30), UtcOffset::minutes(90));
assert_eq!(offset!(-1:30), UtcOffset::minutes(-90));
assert_eq!(offset!(+1:30:59), UtcOffset::seconds(5459));
assert_eq!(offset!(-1:30:59), UtcOffset::seconds(-5459));
assert_eq!(offset!(+23:59:59), UtcOffset::seconds(86_399));
assert_eq!(offset!(-23:59:59), UtcOffset::seconds(-86_399));