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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
include Date_time_components
include Time_ast
include Time
include Infix
module Time_zone = Time_zone
exception Invalid_format_string = Printers.Invalid_format_string
module Span = struct
include Span
let to_string = Printers.string_of_span
let pp = Printers.pp_span
let to_sexp = To_sexp.sexp_of_span
let to_sexp_string x = CCSexp.to_string (To_sexp.sexp_of_span x)
let of_sexp = Of_sexp.(wrap_of_sexp span_of_sexp)
let of_sexp_string = Of_sexp.(wrap_of_sexp_into_of_sexp_string span_of_sexp)
let pp_sexp = Printers.wrap_to_sexp_into_pp_sexp To_sexp.sexp_of_span
end
module Date_time = struct
include Time.Date_time'
type tz_info = Date_time_components.tz_info
let tz_offset_s_of_tz_info = Date_time_components.tz_offset_s_of_tz_info
let to_string = Printers.string_of_date_time
exception
Date_time_cannot_deduce_tz_offset_s = Printers
.Date_time_cannot_deduce_tz_offset_s
let pp = Printers.pp_date_time
let pp_rfc3339 = RFC3339.pp_date_time
let pp_rfc3339_milli = RFC3339.pp_date_time ~precision:3 ()
let pp_rfc3339_micro = RFC3339.pp_date_time ~precision:6 ()
let pp_rfc3339_nano = RFC3339.pp_date_time ~precision:9 ()
let to_rfc3339 = RFC3339.of_date_time
let to_rfc3339_milli = RFC3339.of_date_time ~precision:3
let to_rfc3339_micro = RFC3339.of_date_time ~precision:6
let to_rfc3339_nano = RFC3339.of_date_time ~precision:9
let of_iso8601 = ISO8601.to_date_time
let to_sexp = To_sexp.sexp_of_date_time
let to_sexp_string x = CCSexp.to_string (To_sexp.sexp_of_date_time x)
let of_sexp = Of_sexp.(wrap_of_sexp date_time_of_sexp)
let of_sexp_string =
Of_sexp.(wrap_of_sexp_into_of_sexp_string date_time_of_sexp)
let pp_sexp = Printers.wrap_to_sexp_into_pp_sexp To_sexp.sexp_of_date_time
end
module Interval = struct
include Interval'
let pp = Printers.pp_interval
let to_string = Printers.string_of_interval
end
module Duration = struct
include Duration
let to_string = Printers.string_of_duration
let pp = Printers.pp_duration
let to_sexp = To_sexp.sexp_of_duration
let to_sexp_string =
To_sexp.(wrap_to_sexp_into_to_sexp_string sexp_of_duration)
let of_sexp = Of_sexp.(wrap_of_sexp duration_of_sexp)
let of_sexp_string =
Of_sexp.(wrap_of_sexp_into_of_sexp_string duration_of_sexp)
let pp_sexp = Printers.wrap_to_sexp_into_pp_sexp To_sexp.sexp_of_duration
end
type 'a range = 'a Range.range
type points = Points.t
let make_points = Points.make
let make_points_exn = Points.make_exn
let resolve = Resolver.resolve
let pp_hms = Printers.pp_hms
let string_of_hms = Printers.string_of_hms
let pp_timestamp = Printers.pp_timestamp
let string_of_timestamp = Printers.string_of_timestamp
let pp_timestamp_rfc3339 = RFC3339.pp_timestamp
let pp_timestamp_rfc3339_milli = RFC3339.pp_timestamp ~precision:3 ()
let pp_timestamp_rfc3339_micro = RFC3339.pp_timestamp ~precision:6 ()
let pp_timestamp_rfc3339_nano = RFC3339.pp_timestamp ~precision:9 ()
let rfc3339_of_timestamp = RFC3339.of_timestamp
let rfc3339_milli_of_timestamp = RFC3339.of_timestamp ~precision:3
let rfc3339_micro_of_timestamp = RFC3339.of_timestamp ~precision:6
let rfc3339_nano_of_timestamp = RFC3339.of_timestamp ~precision:9
let pp_intervals = Printers.pp_intervals
let to_sexp = To_sexp.to_sexp
let to_sexp_string = To_sexp.to_sexp_string
let of_sexp = Of_sexp.(wrap_of_sexp of_sexp)
let of_sexp_string = Of_sexp.of_sexp_string
let pp_sexp = Printers.pp_sexp
module Utils = struct
let flatten_month_ranges (months : month range Seq.t) : month Seq.t option =
try Some (Month_ranges.Flatten.flatten months)
with Range.Range_is_invalid -> None
let flatten_month_range_list (months : month range list) : month list option =
try Some (Month_ranges.Flatten.flatten_list months)
with Range.Range_is_invalid -> None
let flatten_month_day_ranges (month_days : int range Seq.t) : int Seq.t option
=
try Some (Month_day_ranges.Flatten.flatten month_days)
with Range.Range_is_invalid -> None
let flatten_month_day_range_list (month_days : int range list) :
int list option =
try Some (Month_day_ranges.Flatten.flatten_list month_days)
with Range.Range_is_invalid -> None
let flatten_weekday_ranges (weekdays : weekday range Seq.t) :
weekday Seq.t option =
try Some (Weekday_ranges.Flatten.flatten weekdays)
with Range.Range_is_invalid -> None
let flatten_weekday_range_list (weekdays : weekday range list) :
weekday list option =
try Some (Weekday_ranges.Flatten.flatten_list weekdays)
with Range.Range_is_invalid -> None
let human_int_of_month = human_int_of_month
let tm_int_of_month = tm_int_of_month
let month_of_human_int = month_of_human_int
let month_of_tm_int = month_of_tm_int
let weekday_of_tm_int = weekday_of_tm_int
let tm_int_of_weekday = tm_int_of_weekday
let second_of_day_of_hms = second_of_day_of_hms
let hms_of_second_of_day = hms_of_second_of_day
end