Skip to content

Commit 7149a0c

Browse files
author
Corentin Leruth
committed
time: add years, to_years and round_years
1 parent e5a977b commit 7149a0c

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

time.ml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -257,12 +257,14 @@ let of_compact_duration s =
257257
let seconds_1m = 60
258258
let seconds_1h = seconds_1m * 60
259259
let seconds_1d = seconds_1h * 24
260+
let seconds_1y = seconds_1d * 365
260261

261262
let time_x factor = (fun x -> float @@ factor * x), (fun x -> int_of_float x / factor), (fun x -> float (int_of_float x / factor * factor))
262263
let (seconds,to_seconds,round_seconds) = time_x 1
263264
let (minutes,to_minutes,round_minutes) = time_x seconds_1m
264265
let (hours,to_hours,round_hours) = time_x seconds_1h
265266
let (days,to_days,round_days) = time_x seconds_1d
267+
let (years,to_years,round_years) = time_x seconds_1y
266268

267269
(** convert integer number of milliseconds to Time.t *)
268270
let msec x = float x /. 1000.

0 commit comments

Comments
 (0)