diff options
Diffstat (limited to 'lib/models/snowflake.ml')
| -rw-r--r-- | lib/models/snowflake.ml | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/models/snowflake.ml b/lib/models/snowflake.ml index 868b2b9..f228bd7 100644 --- a/lib/models/snowflake.ml +++ b/lib/models/snowflake.ml @@ -1,16 +1,16 @@ open Core
-type t = int64 [@@deriving sexp]
+type t = Int.t [@@deriving sexp]
-let of_yojson_exn d = Yojson.Safe.Util.to_string d |> Int64.of_string
+let of_yojson_exn d = Yojson.Safe.Util.to_string d |> Int.of_string
let of_yojson d =
try Ok (of_yojson_exn d)
with Yojson.Safe.Util.Type_error (why,_) -> Error why
-let to_yojson s : Yojson.Safe.t = `String (Int64.to_string s)
+let to_yojson s : Yojson.Safe.t = `String (Int.to_string s)
-let timestamp snowflake = Int64.((snowflake lsr 22) + 1_420_070_400_000L)
+let timestamp snowflake = Int64.(+) (Int64.of_int (snowflake lsr 22)) 1_420_070_400_000L
let time_of_t snowflake =
let t = timestamp snowflake |> Int64.to_float in
|