diff options
author | Lucas Rosa <lrosa008@gmail.com> | 2020-11-03 05:20:11 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-11-03 10:20:11 +0000 |
commit | aa1450bda6666dc22412e937deccffebaf82733c (patch) | |
tree | aced4858ff1a541ec04f422af30911c9b381d6b0 /test | |
parent | 33fd0fb3130bf1f11947385c42e8bfadb3c753e1 (diff) | |
download | gleam_stdlib-aa1450bda6666dc22412e937deccffebaf82733c.tar.gz gleam_stdlib-aa1450bda6666dc22412e937deccffebaf82733c.zip |
gleam/os add timestamp function (#117)
Diffstat (limited to 'test')
-rw-r--r-- | test/gleam/os_test.gleam | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/test/gleam/os_test.gleam b/test/gleam/os_test.gleam index 45fc0ef..815a9e0 100644 --- a/test/gleam/os_test.gleam +++ b/test/gleam/os_test.gleam @@ -26,3 +26,15 @@ pub fn system_time_test() { { os.system_time(os.Millisecond) < june_12_2020 * 1000000 } |> should.equal(True) } + +pub fn erlang_timestamp_test() { + // in microseconds + let june_12_2020 = 1591966971000000 + let tuple(mega_seconds, seconds, micro_seconds) = os.erlang_timestamp() + + let stamp_as_micro = + { mega_seconds * 1_000_000 + seconds } * 1_000_000 + micro_seconds + + { stamp_as_micro > june_12_2020 } + |> should.be_true() +} |