Skip to main content

minute_index

Function minute_index 

Source
pub fn minute_index(time: impl Timelike) -> usize
Expand description

Calculates the minute index within a day (0..1439) for a given NaiveTime.

This is used to map events into per-minute buckets.

ยงExamples

use chrono::NaiveTime;
use bloop_server_framework::statistics::minute_index;

let time = NaiveTime::from_hms_opt(13, 45, 0).unwrap();
let idx = minute_index(time);

assert_eq!(idx, 13 * 60 + 45);