time.interval_elapsed_ratio

FLOATtime.interval_elapsed_ratioTIMErefTIMEstartTIMEend

Available inall subroutines.

Returns the proportion of time between start and end that has elapsed at the reference time, as a number between 0 and 1.

Example

declare local var.ratio FLOAT;
set var.ratio = time.interval_elapsed_ratio(now, std.time("2024-01-01 00:00:00", now),
std.time("2025-01-01 00:00:00", now));
if (req.digest.ratio > var.ratio) {
// Request is eligible for A/B test
}