summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--rts/PrimOps.cmm6
1 files changed, 5 insertions, 1 deletions
diff --git a/rts/PrimOps.cmm b/rts/PrimOps.cmm
index 6c3593e4a4..c3ab788ba2 100644
--- a/rts/PrimOps.cmm
+++ b/rts/PrimOps.cmm
@@ -2118,7 +2118,11 @@ delayzh_fast
W_ time;
W_ divisor;
(time) = foreign "C" getourtimeofday() [R1];
- divisor = TO_W_(RtsFlags_MiscFlags_tickInterval(RtsFlags))*1000;
+ divisor = TO_W_(RtsFlags_MiscFlags_tickInterval(RtsFlags));
+ if (divisor == 0) {
+ divisor = 50;
+ }
+ divisor = divisor * 1000;
target = ((R1 + divisor - 1) / divisor) /* divide rounding up */
+ time + 1; /* Add 1 as getourtimeofday rounds down */
StgTSO_block_info(CurrentTSO) = target;