aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator/beam/erl_time.h
diff options
context:
space:
mode:
authorRickard Green <[email protected]>2015-03-24 16:56:08 +0100
committerRickard Green <[email protected]>2015-03-24 16:56:08 +0100
commit5345727d647ea65b7a0417c87b94cf958ef9ee13 (patch)
treebcc1c75102741e9768c88b1481390e40e32586e7 /erts/emulator/beam/erl_time.h
parenta11cec66e37c039d33091db056c0ae44405043ac (diff)
parentc20482023b70768bd84d25f1e34dbbc2fe09cf31 (diff)
downloadotp-5345727d647ea65b7a0417c87b94cf958ef9ee13.tar.gz
otp-5345727d647ea65b7a0417c87b94cf958ef9ee13.tar.bz2
otp-5345727d647ea65b7a0417c87b94cf958ef9ee13.zip
Merge branch 'rickard/time_api/OTP-11997'
* rickard/time_api/OTP-11997: Better OS system time implementation Documentation adjustments Fix zero timout timers erts_sys_hrtime() for lcnt Better support for poor os monotonic sources Conflicts: erts/preloaded/ebin/erlang.beam
Diffstat (limited to 'erts/emulator/beam/erl_time.h')
-rw-r--r--erts/emulator/beam/erl_time.h18
1 files changed, 5 insertions, 13 deletions
diff --git a/erts/emulator/beam/erl_time.h b/erts/emulator/beam/erl_time.h
index c9cda4d10e..cb7764addc 100644
--- a/erts/emulator/beam/erl_time.h
+++ b/erts/emulator/beam/erl_time.h
@@ -148,6 +148,7 @@ ErtsTimeOffsetState erts_finalize_time_offset(void);
struct process;
Eterm erts_get_monotonic_start_time(struct process *c_p);
Eterm erts_monotonic_time_source(struct process*c_p);
+Eterm erts_system_time_source(struct process*c_p);
#ifdef SYS_CLOCK_RESOLUTION
#define ERTS_CLKTCK_RESOLUTION ((ErtsMonotonicTime) (SYS_CLOCK_RESOLUTION*1000))
@@ -219,6 +220,10 @@ erts_time_unit_conversion(Uint64 value,
* it is assumed (and need) to be a power of 10.
*/
+#if ERTS_COMPILE_TIME_MONOTONIC_TIME_UNIT < 1000*1000
+# error Compile time time unit needs to be at least 1000000
+#endif
+
#define ERTS_MONOTONIC_TIME_UNIT \
((ErtsMonotonicTime) ERTS_COMPILE_TIME_MONOTONIC_TIME_UNIT)
@@ -248,19 +253,6 @@ erts_time_unit_conversion(Uint64 value,
#define ERTS_USEC_TO_MONOTONIC__(USEC) ((ErtsMonotonicTime) (USEC))
#define ERTS_NSEC_TO_MONOTONIC__(NSEC) (((ErtsMonotonicTime) (NSEC))/1000)
-#elif ERTS_COMPILE_TIME_MONOTONIC_TIME_UNIT == 1000
-/* Milli-second time unit */
-
-#define ERTS_MONOTONIC_TO_SEC__(MSEC) ((USEC)/(1000))
-#define ERTS_MONOTONIC_TO_MSEC__(MSEC) (MSEC)
-#define ERTS_MONOTONIC_TO_USEC__(MSEC) ((MSEC)*1000)
-#define ERTS_MONOTONIC_TO_NSEC__(MSEC) ((MSEC)*(1000*1000))
-
-#define ERTS_SEC_TO_MONOTONIC__(SEC) (((ErtsMonotonicTime) (SEC))*1000)
-#define ERTS_MSEC_TO_MONOTONIC__(MSEC) ((ErtsMonotonicTime) (MSEC))
-#define ERTS_USEC_TO_MONOTONIC__(USEC) (((ErtsMonotonicTime) (USEC))/1000)
-#define ERTS_NSEC_TO_MONOTONIC__(NSEC) (((ErtsMonotonicTime) (NSEC))/(1000*1000))
-
#else
#error Missing implementation for monotonic time unit
#endif