1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
module Ms_time = struct
type t = float
let weekday_of_tm_wday = function
| 0 -> "Sun"
| 1 -> "Mon"
| 2 -> "Tue"
| 3 -> "Wed"
| 4 -> "Thu"
| 5 -> "Fri"
| 6 -> "Sat"
| d -> failwith @@ Printf.sprintf "Day number unknown: %i" d
let month_of_tm_mon = function
| 0 -> "Jan"
| 1 -> "Feb"
| 2 -> "Mar"
| 3 -> "Apr"
| 4 -> "May"
| 5 -> "Jun"
| 6 -> "Jul"
| 7 -> "Aug"
| 8 -> "Sep"
| 9 -> "Oct"
| 10 -> "Nov"
| 11 -> "Dec"
| d -> failwith @@ Printf.sprintf "Month number unknown: %i" d
let create time = time
let create_now = create Unix.time
let x_ms_date time =
let t = Unix.gmtime time in
let weekday = weekday_of_tm_wday t.tm_wday in
Printf.sprintf "%s, %02i %s %i %02i:%02i:%02i GMT" weekday t.tm_mday
(month_of_tm_mon t.tm_mon) (t.tm_year + 1900) t.tm_hour t.tm_min t.tm_sec
end
module Verb = Verb
let take_first n l =
let rec part i yes no = function
| [] -> (List.rev yes, List.rev no)
| x :: l -> if i <= n then part (i + 1) (x :: yes) no l else (yes, x :: l)
in
part 0 [] [] l