aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPeter Saxton <peterhsaxton@gmail.com>2020-06-12 14:07:34 +0100
committerLouis Pilfold <louis@lpil.uk>2020-06-16 10:21:40 +0100
commite229b0c4bd59736c99717559439416b1784442c2 (patch)
treed66fd08e773bf1f58eb1129264963e8c15489bfe /src
parentbd6715c6c2b1e5b4eab88f47c007fbab1d81ab22 (diff)
downloadgleam_stdlib-e229b0c4bd59736c99717559439416b1784442c2.tar.gz
gleam_stdlib-e229b0c4bd59736c99717559439416b1784442c2.zip
add a call to the os system time
Diffstat (limited to 'src')
-rw-r--r--src/gleam/os.gleam13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/gleam/os.gleam b/src/gleam/os.gleam
index 8ae522d..0c3f38a 100644
--- a/src/gleam/os.gleam
+++ b/src/gleam/os.gleam
@@ -45,3 +45,16 @@ pub fn delete_env(key: String) -> Nil {
os_unsetenv(string_to_char_list(key))
Nil
}
+
+pub type TimeUnit {
+ Second
+ Millisecond
+ Microsecond
+ Nanosecond
+}
+
+/// Return the current OS system time.
+///
+/// https://erlang.org/doc/apps/erts/time_correction.html#OS_System_Time
+pub external fn system_time(TimeUnit) -> Int =
+ "os" "system_time"