diff options
Diffstat (limited to 'src/utils.php')
| -rw-r--r-- | src/utils.php | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/utils.php b/src/utils.php index 325603b..a11fa16 100644 --- a/src/utils.php +++ b/src/utils.php @@ -58,7 +58,13 @@ function format_timestamp(int $timestamp_secs) return "$days day" . ($days > 1 ? "s" : ""); } } + function clamp(int $current, int $min, int $max): int { return max($min, min($max, $current)); +} + +function in_range(float $value, float $min, float $max): bool +{ + return $min <= $value && $value <= $max; }
\ No newline at end of file |
