diff options
authorEdward Welbourne <>2017-10-13 18:10:39 +0200
committerEdward Welbourne <>2017-10-16 16:11:19 +0000
commita090076e93487f8e461d9b866b9da1c0c21cb59b (patch)
parent414c058ca70f8e2d0a43686aa1644534a628b3ef (diff)
Don't lose precision in QMacTimeZonePrivate::previousTransition()
NSTimeInterval is a typedef for double, but the code stored its value in an int, and only then multiplied by 1000. Fix by only truncating NSTimeIntervals to int(64_t) *after* the multiplication by 1e3 to get milliseconds. While it's highly unlikely that a transition will have fractional seconds length, don't assume if you can just calculate the more exact result. Adapted-From: Marc Mutz <> Change-Id: I0911b9c945a94ca24c3dfb23ed6a849141076326 Reviewed-by: Jake Petroules <>
1 files changed, 1 insertions, 1 deletions
diff --git a/src/corelib/tools/ b/src/corelib/tools/
index 876dc2d877..fa0dd87cfc 100644
--- a/src/corelib/tools/
+++ b/src/corelib/tools/
@@ -295,7 +295,7 @@ QTimeZonePrivate::Data QMacTimeZonePrivate::previousTransition(qint64 beforeMSec
if (prevSecs < endSecs) // i.e. we did make it into that while loop
- return data(qint64(prevSecs) * 1000);
+ return data(qint64(prevSecs * 1e3));
// No transition data; or first transition later than requested time.
return invalidData();