Skip to content

Commit 26e6648

Browse files
raphael-proustrr0gi
authored andcommitted
Time.{start,end}_of_day
1 parent c2c7b5e commit 26e6648

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

time.ml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -280,3 +280,12 @@ let ago_str = show_duration $ ago
280280
(* compat *)
281281
let int = to_seconds
282282
let to_sec = to_seconds
283+
284+
let start_of_day t =
285+
let t = Unix.gmtime t in
286+
ExtUnix.Specific.timegm { t with tm_sec = 0; tm_min = 0; tm_hour = 0 }
287+
288+
let end_of_day t =
289+
let t = Unix.gmtime t in
290+
ExtUnix.Specific.timegm { t with tm_sec = 59; tm_min = 59; tm_hour = 23 }
291+

0 commit comments

Comments
 (0)