aboutsummaryrefslogtreecommitdiff
path: root/lib/models/snowflake.mli
blob: 7d5cca8ad7e44e6db376e273d442851f8f5aaf11 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
open Core

type t = Int.t [@@deriving sexp, yojson { exn = true }]

(** Convert a snowflake into a {!Core.Time.t} *)
val time_of_t : t -> Time.t

(** Convert a snowflake into a Unix timestamp. Millisecond precision. *)
val timestamp : t -> int64

(** Convert a snowflake into an ISO8601 timestamp string. This is equivalent to calling [Snowflake.time_of_t snowflake |> Time.(to_string_iso8601_basic ~zone:Zone.utc)] *)
val timestamp_iso : t -> string