diff options
author | Rickard Green <[email protected]> | 2016-01-19 17:05:55 +0100 |
---|---|---|
committer | Rickard Green <[email protected]> | 2016-01-21 15:10:09 +0100 |
commit | 3f33428db9aea0d767295322c4e882a5c6bbf7db (patch) | |
tree | 331741cf9e941f15f689f790d0f2e354450bf25b /erts/emulator/beam/io.c | |
parent | dc8e62f33ad0ca7a772ec74d67b6d3e157f639b4 (diff) | |
download | otp-3f33428db9aea0d767295322c4e882a5c6bbf7db.tar.gz otp-3f33428db9aea0d767295322c4e882a5c6bbf7db.tar.bz2 otp-3f33428db9aea0d767295322c4e882a5c6bbf7db.zip |
Introduce time management in native APIs
Diffstat (limited to 'erts/emulator/beam/io.c')
-rw-r--r-- | erts/emulator/beam/io.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/erts/emulator/beam/io.c b/erts/emulator/beam/io.c index c64c8802b9..2bd31ee97e 100644 --- a/erts/emulator/beam/io.c +++ b/erts/emulator/beam/io.c @@ -50,6 +50,7 @@ #include "erl_map.h" #include "erl_bif_unique.h" #include "erl_hl_timer.h" +#include "erl_time.h" extern ErlDrvEntry fd_driver_entry; #ifndef __OSE__ @@ -6762,6 +6763,28 @@ driver_get_now(ErlDrvNowData *now_data) return 0; } +ErlDrvTime +erl_drv_monotonic_time(ErlDrvTimeUnit time_unit) +{ + return (ErlDrvTime) erts_napi_monotonic_time((int) time_unit); +} + +ErlDrvTime +erl_drv_time_offset(ErlDrvTimeUnit time_unit) +{ + return (ErlDrvTime) erts_napi_time_offset((int) time_unit); +} + +ErlDrvTime +erl_drv_convert_time_unit(ErlDrvTime val, + ErlDrvTimeUnit from, + ErlDrvTimeUnit to) +{ + return (ErlDrvTime) erts_napi_convert_time_unit((ErtsMonotonicTime) val, + (int) from, + (int) to); +} + static void ref_to_driver_monitor(Eterm ref, ErlDrvMonitor *mon) { RefThing *refp; |