Commits

camlspotter committed 356e690

epoch -> from_epoch

Comments (0)

Files changed (1)

     i
 
   type t = { date : Date.t;
-             epoch : float;
+             from_epoch : float;
              tm : Unix0.tm }
 
   let to_string t = 
-    Printf.sprintf "{date = %s; epoch = %f; tm = %s}"
+    Printf.sprintf "{date = %s; from_epoch = %f; tm = %s}"
       (Date.to_string t.date)
-      t.epoch
+      t.from_epoch
       (Unix.string_of_tm t.tm)
 
   let create date = 
     match Unix.to_tm date with
     | None -> `Error (`Invalid_date date)
-    | Some (epoch, tm, mal) ->
+    | Some (from_epoch, tm, mal) ->
         match mal with
         | `Invalid -> `Error (`Invalid_date date)
-        | `Ok -> `Ok { date; epoch; tm }
+        | `Ok -> `Ok { date; from_epoch; tm }
 
   let secs_of_day = 
     let open Xint64 in
      This function is now purely testing purpose to check the correctness
      of [Date.diff].
      
-     Pretty dirty rounding hack of local epochs which might be
+     Pretty dirty rounding hack of local from_epochs which might be
      calculated from historical different local time settings.
      +-4hours are accepted.
   *)
   let diff t1 t2 = 
     let open Xint64 in
-    let d = int64_of_float & t1.epoch -. t2.epoch in
+    let d = int64_of_float & t1.from_epoch -. t2.from_epoch in
     let div = Int64.to_int & d / secs_of_day in
     let rem = Int64.rem d secs_of_day in
     let fixed_div = 
   let rec random () = 
     let d = Date.random_with_invalid () in
     match Unix.to_tm d with
-    | Some (f, tm, `Ok) -> { date = d; epoch = f; tm }
+    | Some (f, tm, `Ok) -> { date = d; from_epoch = f; tm }
     | Some (_, _, `Invalid) -> random ()
     | None -> random ()