Struct polars_time::Window
source · pub struct Window {
pub offset: Duration,
/* private fields */
}
Expand description
Represents a window in time
Fields§
§offset: Duration
Implementations§
source§impl Window
impl Window
pub fn new(every: Duration, period: Duration, offset: Duration) -> Self
sourcepub fn truncate_ns(&self, t: i64) -> i64
pub fn truncate_ns(&self, t: i64) -> i64
Truncate the given ns timestamp by the window boundary.
pub fn truncate_no_offset_ns(&self, t: i64) -> i64
sourcepub fn truncate_us(&self, t: i64) -> i64
pub fn truncate_us(&self, t: i64) -> i64
Truncate the given ns timestamp by the window boundary.
pub fn truncate_no_offset_us(&self, t: i64) -> i64
pub fn truncate_ms(&self, t: i64) -> i64
pub fn truncate_no_offset_ms(&self, t: i64) -> i64
sourcepub fn get_earliest_bounds_ns(&self, t: i64) -> Bounds
pub fn get_earliest_bounds_ns(&self, t: i64) -> Bounds
returns the bounds for the earliest window bounds that contains the given time t. For underlapping windows that do not contain time t, the window directly after time t will be returned.
For every
larger than 1day
we just take the given timestamp t
as start as truncation
does not seems intuitive.
Below 1 day, it make sense to truncate to:
- days
- hours
- 15 minutes
- etc.
But for 2w3d, it does not make sense to start it on a different lower bound, so we start at t