aboutsummaryrefslogtreecommitdiff
path: root/lib/models/snowflake.ml
diff options
context:
space:
mode:
authorMatias Goldfeld <[email protected]>2021-01-29 13:40:47 -0500
committerMatias Goldfeld <[email protected]>2021-01-29 13:40:47 -0500
commita44882d0e2c7b3397fc6c6c616e554eeb2248fdb (patch)
treef0fc6ff32bbf586b94d573ecb4c99b17324ea0ee /lib/models/snowflake.ml
parentRevert "Started conversion to ppx_yojson_conv" (diff)
downloaddisml-a44882d0e2c7b3397fc6c6c616e554eeb2248fdb.tar.xz
disml-a44882d0e2c7b3397fc6c6c616e554eeb2248fdb.zip
Revert "More Int64 refactors"
This reverts commit b499169e93e9f7bdd0f877a3cdf0247ec495abe1.
Diffstat (limited to 'lib/models/snowflake.ml')
-rw-r--r--lib/models/snowflake.ml8
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