aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRickard Green <[email protected]>2015-07-08 20:05:20 +0200
committerRickard Green <[email protected]>2015-07-08 20:10:29 +0200
commita782ed0ca14952dd83560ad7c5a43888bef19cdb (patch)
tree13c1ccfa68dc44a5eb1873333f46de4b480e1b43
parent4a864c1cbe16a42f3f5190881187e3c9849e985f (diff)
downloadotp-a782ed0ca14952dd83560ad7c5a43888bef19cdb.tar.gz
otp-a782ed0ca14952dd83560ad7c5a43888bef19cdb.tar.bz2
otp-a782ed0ca14952dd83560ad7c5a43888bef19cdb.zip
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))