Skip to main content

get_time_bar_bounds

Function get_time_bar_bounds 

Source
pub fn get_time_bar_bounds(
    now: Timestamp,
    bar_type: &BarType,
    time_bars_origin: Option<SignedDuration>,
    time_zone: &TimeZone,
    calendar_origin: Option<Date>,
) -> (Timestamp, Timestamp, Timestamp)
Expand description

Returns the previous, current, and next time bar boundaries in UTC.

Days and longer periods follow local calendar boundaries in time_zone. The origin offset shifts the nominal civil boundary before resolving DST gaps and folds. Shorter periods retain UTC alignment. Gaps shift forward; folds use the first occurrence. calendar_origin keeps the recurrence grid anchored to a timer’s starting local date; None uses the current local date.

§Panics

Panics if the aggregation is unsupported or calendar arithmetic exceeds the supported range.