Skip to main content

Module timeframe_utils

Module timeframe_utils 

Source
Expand description

Utilities for timeframe operations and timestamp generation

This module provides utilities for working with timeframes, generating aligned timestamps, and converting between timeframes.

Functions§

align_timestamp
Align a timestamp to the start of a timeframe bucket
alignment_ratio
Calculate the alignment ratio between two timeframes
count_rows
Count the number of rows between two timestamps for a given timeframe
find_closest_index
Find the closest index in a sorted array of timestamps Returns the index of the timestamp closest to the target
find_common_timeframe
Find the common timeframe that both can align to (the finer one)
find_covering_index
Find the index in source timestamps that covers the target timestamp Uses binary search for efficiency
generate_timestamps
Generate a series of aligned timestamps for a given timeframe
generate_timestamps_micros
Generate timestamps as i64 microseconds for SIMD operations
is_timeframe_compatible
Check if one timeframe is compatible with another (can be evenly divided)
parse_timeframe_string
Parse a timeframe string (e.g., “1m”, “1h”, “1d”)
timeframe_to_duration
Convert a timeframe to a Duration
timeframe_to_minutes
Get the numeric value of a timeframe in minutes