aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator/beam/erl_nif.c
diff options
context:
space:
mode:
authorRickard Green <[email protected]>2016-01-19 17:05:55 +0100
committerRickard Green <[email protected]>2016-01-21 15:10:09 +0100
commit3f33428db9aea0d767295322c4e882a5c6bbf7db (patch)
tree331741cf9e941f15f689f790d0f2e354450bf25b /erts/emulator/beam/erl_nif.c
parentdc8e62f33ad0ca7a772ec74d67b6d3e157f639b4 (diff)
downloadotp-3f33428db9aea0d767295322c4e882a5c6bbf7db.tar.gz
otp-3f33428db9aea0d767295322c4e882a5c6bbf7db.tar.bz2
otp-3f33428db9aea0d767295322c4e882a5c6bbf7db.zip
Introduce time management in native APIs
Diffstat (limited to 'erts/emulator/beam/erl_nif.c')
-rw-r--r--erts/emulator/beam/erl_nif.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/erts/emulator/beam/erl_nif.c b/erts/emulator/beam/erl_nif.c
index d7a2076d85..3141b05e2b 100644
--- a/erts/emulator/beam/erl_nif.c
+++ b/erts/emulator/beam/erl_nif.c
@@ -1175,6 +1175,26 @@ void enif_thread_exit(void *resp) { erl_drv_thread_exit(resp); }
int enif_thread_join(ErlNifTid tid, void **respp) { return erl_drv_thread_join(tid,respp); }
int enif_getenv(const char *key, char *value, size_t *value_size) { return erl_drv_getenv(key, value, value_size); }
+ErlNifTime enif_monotonic_time(ErlNifTimeUnit time_unit)
+{
+ return (ErlNifTime) erts_napi_monotonic_time((int) time_unit);
+}
+
+ErlNifTime enif_time_offset(ErlNifTimeUnit time_unit)
+{
+ return (ErlNifTime) erts_napi_time_offset((int) time_unit);
+}
+
+ErlNifTime
+enif_convert_time_unit(ErlNifTime val,
+ ErlNifTimeUnit from,
+ ErlNifTimeUnit to)
+{
+ return (ErlNifTime) erts_napi_convert_time_unit((ErtsMonotonicTime) val,
+ (int) from,
+ (int) to);
+}
+
int enif_fprintf(void* filep, const char* format, ...)
{
int ret;