pub struct QuarterHour(/* private fields */);Expand description
Fifteen minutes of real time, starting at an instant on a quarter-hour boundary.
Named by its start. See the module documentation for why, and for the conversion a market-facing adapter needs.
Written on the wire as the RFC 3339 spelling of its start, through
crate::wire: time’s own serialisation is a nine-element array of its
internal fields, which no partner can read and no version of time
promises to keep.
Implementations§
Source§impl QuarterHour
impl QuarterHour
Sourcepub const PERIODS_PER_ORDINARY_DAY: u32 = 96
pub const PERIODS_PER_ORDINARY_DAY: u32 = 96
How many periods a day has when nothing moves the clock — the number
[PTB-A 50.7 §3.1.7.2] requires a meter to preserve across a
synchronisation.
Nothing in the settlement grid counts to it: a grid built by adding
fifteen minutes of real time needs no branch for a clock change, which is
why emob_session::split has none. What the number is for is the
question one layer out — how many Messperioden a given day actually has —
and Self::periods_in_local_day answers that by walking the same grid
rather than by returning this (D218).
Sourcepub fn periods_in_local_day(zone: &TimeZone, date: Date) -> Option<u32>
pub fn periods_in_local_day(zone: &TimeZone, date: Date) -> Option<u32>
How many settlement periods one local calendar day holds in a zone.
A quarter hour is fifteen minutes of real time and a local day is the
span between two local midnights, so an ordinary day has
Self::PERIODS_PER_ORDINARY_DAY, a spring-forward day 92 and an
autumn-fold day 100. That is the number a balance-group submission is
validated against [A6 §IV.1]: a series with 96 entries for 25 October
is missing an hour of somebody’s balance group, and one with 96 for
29 March carries four periods that did not happen.
Measured between the two midnights rather than read from a table of transition dates, so a zone that shifts by half an hour, at an hour other than 02:00, or not at all needs no case.
None is an answer rather than an absence: the day is not a whole
number of settlement periods, because a midnight does not land on the
grid. Every civil offset in use today is a whole number of quarter hours
— the fact emob_session::split relies on to have no daylight-saving
branch — so it takes an offset like Liberia’s -00:44:30 before 1972 to
reach, and returning 96 there would state a period count for a day that
has none.
Sourcepub fn containing(at: OffsetDateTime) -> QuarterHour
pub fn containing(at: OffsetDateTime) -> QuarterHour
The quarter hour that contains at.
Sourcepub fn is_boundary(at: OffsetDateTime) -> bool
pub fn is_boundary(at: OffsetDateTime) -> bool
Whether an instant falls exactly on a period boundary.
The question [PTB-A 50.7 §3.1.7.2] makes load-bearing for prices: “Ein
Tarifwechsel ist erst mit dem Beginn der nächsten Messperiode
durchzuführen.” A change that lands mid-period would put one settlement
slot under two tariffs, which is a slot nobody can allocate and a price
nobody can reproduce.
Sourcepub fn boundary_at_or_after(at: OffsetDateTime) -> OffsetDateTime
pub fn boundary_at_or_after(at: OffsetDateTime) -> OffsetDateTime
The first period boundary at or after an instant.
What a tariff change that has to be aligned should be moved to: forward, never back, because a price may not start applying earlier than it was published.
Sourcepub const fn start(self) -> OffsetDateTime
pub const fn start(self) -> OffsetDateTime
The instant this quarter hour begins.
Sourcepub fn end(self) -> OffsetDateTime
pub fn end(self) -> OffsetDateTime
The instant it ends, which is the next one’s start.
Sourcepub fn metering_timestamp(self) -> OffsetDateTime
pub fn metering_timestamp(self) -> OffsetDateTime
The timestamp German metrology and the market side label this period
with — its end [PTB-A 50.7 §3.1.7.2].
The same instant as Self::end, under the name that says which
convention is being spoken. An adapter writing an MSCONS load profile or
handing a series to mako-emob calls this; everything inside this
workspace uses Self::start. Reaching for the wrong one shifts every
slot by fifteen minutes, which sums to zero and is wrong for every
individual balance group.
Sourcepub fn next(self) -> QuarterHour
pub fn next(self) -> QuarterHour
The quarter hour after this one.
Trait Implementations§
Source§impl Clone for QuarterHour
impl Clone for QuarterHour
Source§fn clone(&self) -> QuarterHour
fn clone(&self) -> QuarterHour
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for QuarterHour
Source§impl Debug for QuarterHour
impl Debug for QuarterHour
Source§impl<'de> Deserialize<'de> for QuarterHour
Available on crate feature serde only.
impl<'de> Deserialize<'de> for QuarterHour
serde only.Source§fn deserialize<D>(
deserializer: D,
) -> Result<QuarterHour, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
fn deserialize<D>(
deserializer: D,
) -> Result<QuarterHour, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
Source§impl Display for QuarterHour
impl Display for QuarterHour
impl Eq for QuarterHour
Source§impl Hash for QuarterHour
impl Hash for QuarterHour
Source§impl Ord for QuarterHour
impl Ord for QuarterHour
Source§fn cmp(&self, other: &QuarterHour) -> Ordering
fn cmp(&self, other: &QuarterHour) -> Ordering
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
1.21.0 (const: unstable) · Source§fn min(self, other: Self) -> Selfwhere
Self: Sized,
fn min(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl PartialEq for QuarterHour
impl PartialEq for QuarterHour
Source§impl PartialOrd for QuarterHour
impl PartialOrd for QuarterHour
Source§impl Serialize for QuarterHour
Available on crate feature serde only.
impl Serialize for QuarterHour
serde only.