//#region src/utils/frameTime.ts
/**
* Frame timing utilities for quantizing time values to frame boundaries.
* These utilities ensure consistent frame-aligned timing across the codebase.
*/
/** Default FPS when none is specified */
const DEFAULT_FPS = 30;
/**
* Calculate the duration of a single frame in milliseconds.
*/
function calculateFrameIntervalMs(fps) {
	if (fps <= 0) return 1e3 / DEFAULT_FPS;
	return 1e3 / fps;
}
/**
* Quantize a time value (in milliseconds) to the nearest frame boundary.
* This ensures frame markers align perfectly with playhead position.
*/
function quantizeToFrameTimeMs(timeMs, fps) {
	if (!fps || fps <= 0) return timeMs;
	const frameDurationMs = calculateFrameIntervalMs(fps);
	return Math.round(timeMs / frameDurationMs) * frameDurationMs;
}
/**
* Quantize a time value (in seconds) to the nearest frame boundary.
* This ensures time values align with frame boundaries for consistent rendering.
*/
function quantizeToFrameTimeS(timeSeconds, fps) {
	if (!fps || fps <= 0) return timeSeconds;
	const frameDurationS = 1 / fps;
	return Math.round(timeSeconds / frameDurationS) * frameDurationS;
}

//#endregion
export { quantizeToFrameTimeMs, quantizeToFrameTimeS };
//# sourceMappingURL=frameTime.js.map