aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorErlang/OTP <[email protected]>2015-07-08 20:31:19 +0200
committerErlang/OTP <[email protected]>2015-07-08 20:31:19 +0200
commita527a19e03c9c05e578cf998434c67c6cce86e6f (patch)
tree6379360132c1923bfeb657dd5177004145327126
parent385b215c420b1a3b98f02a67c562f2ed0512f17a (diff)
parenta782ed0ca14952dd83560ad7c5a43888bef19cdb (diff)
downloadotp-a527a19e03c9c05e578cf998434c67c6cce86e6f.tar.gz
otp-a527a19e03c9c05e578cf998434c67c6cce86e6f.tar.bz2
otp-a527a19e03c9c05e578cf998434c67c6cce86e6f.zip
Merge branch 'rickard/end-time-fix/OTP-12896' into maint-18
* rickard/end-time-fix/OTP-12896: Fix calculation of end time
-rw-r--r--erts/emulator/beam/erl_time.h6
1 files changed, 4 insertions, 2 deletions
diff --git a/erts/emulator/beam/erl_time.h b/erts/emulator/beam/erl_time.h
index 36a3d52264..43e543e035 100644
--- a/erts/emulator/beam/erl_time.h
+++ b/erts/emulator/beam/erl_time.h
@@ -345,8 +345,10 @@ erts_time_unit_conversion(Uint64 value,
#endif /* !ERTS_COMPILE_TIME_MONOTONIC_TIME_UNIT */
#define ERTS_MONOTONIC_TIME_END_EXTERNAL \
- (ERTS_MONOTONIC_TIME_START_EXTERNAL \
- + (ERTS_MONOTONIC_END - ERTS_MONOTONIC_BEGIN))
+ (ERTS_MONOTONIC_TIME_START_EXTERNAL < 0 \
+ ? (ERTS_MONOTONIC_TIME_START_EXTERNAL \
+ + (ERTS_MONOTONIC_END - ERTS_MONOTONIC_BEGIN)) \
+ : (ERTS_MONOTONIC_END - ERTS_MONOTONIC_TIME_START_EXTERNAL))
#define ERTS_MSEC_TO_CLKTCKS__(MON) \
((MON) * (ERTS_CLKTCK_RESOLUTION/1000))