summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorEdward Welbourne <[email protected]>2023-04-24 16:58:46 +0200
committerEdward Welbourne <[email protected]>2023-04-26 21:11:01 +0200
commitf291575d95ab0159fa809c63855f787ccb1877f5 (patch)
tree4f91a6a441d85a8923933974db9bcc3140480141 /src
parentaad3b1f063e68cfdcbc099e0ae5c001319d99dcc (diff)
Relocate two helpers from QLocalTime to an anonymous namespace
When I broke them out from functions in the QLocalTime namespace I didn't notice that's where I was putting them; they don't belong there. Change-Id: If4c9d996b3e46b3b46a29a97d0bcc2cac72c91ab Reviewed-by: MÃ¥rten Nordheim <[email protected]>
Diffstat (limited to 'src')
-rw-r--r--src/corelib/time/qlocaltime.cpp36
1 files changed, 18 insertions, 18 deletions
diff --git a/src/corelib/time/qlocaltime.cpp b/src/corelib/time/qlocaltime.cpp
index d8c0a3f823d..84a96a48d48 100644
--- a/src/corelib/time/qlocaltime.cpp
+++ b/src/corelib/time/qlocaltime.cpp
@@ -165,6 +165,24 @@ struct tm timeToTm(qint64 localDay, int secs, QDateTimePrivate::DaylightStatus d
return local;
}
+#define IC(N) std::integral_constant<qint64, N>()
+
+// True if combining day and seconds overflows qint64; otherwise, sets *epochSeconds
+inline bool daysAndSecondsOverflow(qint64 julianDay, qint64 daySeconds, qint64 *epochSeconds)
+{
+ return mul_overflow(julianDay - JULIAN_DAY_FOR_EPOCH, IC(SECS_PER_DAY), epochSeconds)
+ || add_overflow(*epochSeconds, daySeconds, epochSeconds);
+}
+
+// True if combining seconds and millis overflows; otherwise sets *epochMillis
+inline bool secondsAndMillisOverflow(qint64 epochSeconds, qint64 millis, qint64 *epochMillis)
+{
+ return mul_overflow(epochSeconds, IC(MSECS_PER_SEC), epochMillis)
+ || add_overflow(*epochMillis, millis, epochMillis);
+}
+
+#undef IC
+
} // namespace
namespace QLocalTime {
@@ -232,24 +250,6 @@ int getUtcOffset(qint64 atMSecsSinceEpoch)
}
#endif // QT_BOOTSTRAPPED
-#define IC(N) std::integral_constant<qint64, N>()
-
-// True if combining day and seconds overflows qint64; otherwise, sets *epochSeconds
-inline bool daysAndSecondsOverflow(qint64 julianDay, qint64 daySeconds, qint64 *epochSeconds)
-{
- return mul_overflow(julianDay - JULIAN_DAY_FOR_EPOCH, IC(SECS_PER_DAY), epochSeconds)
- || add_overflow(*epochSeconds, daySeconds, epochSeconds);
-}
-
-// True if combining seconds and millis overflows; otherwise sets *epochMillis
-inline bool secondsAndMillisOverflow(qint64 epochSeconds, qint64 millis, qint64 *epochMillis)
-{
- return mul_overflow(epochSeconds, IC(MSECS_PER_SEC), epochMillis)
- || add_overflow(*epochMillis, millis, epochMillis);
-}
-
-#undef IC
-
// Calls the platform variant of localtime() for the given utcMillis, and
// returns the local milliseconds, offset from UTC and DST status.
QDateTimePrivate::ZoneState utcToLocal(qint64 utcMillis)