Qt 6.x
The Qt SDK
Loading...
Searching...
No Matches
QLocalTime Namespace Reference

Classes

struct  SystemMillisRange
 

Functions

int getCurrentStandardUtcOffset ()
 
int getUtcOffset (qint64 atMSecsSinceEpoch)
 
QDateTimePrivate::ZoneState utcToLocal (qint64 utcMillis)
 
QString localTimeAbbbreviationAt (qint64 local, QDateTimePrivate::DaylightStatus dst)
 
QDateTimePrivate::ZoneState mapLocalTime (qint64 local, QDateTimePrivate::DaylightStatus dst)
 
SystemMillisRange computeSystemMillisRange ()
 

Function Documentation

◆ computeSystemMillisRange()

SystemMillisRange QLocalTime::computeSystemMillisRange ( )

Determine the range of the system time_t functions.

On MS-systems (where time_t is 64-bit by default), the start-point is the epoch, the end-point is the end of the year 3000 (for mktime(); for _localtime64_s it's 18 days later, but we ignore that here). Darwin's range runs from the beginning of 1900 to the end of its 64-bit time_t and Linux uses the full range of time_t (but this might still be 32-bit on some embedded systems).

(One potential constraint might appear to be the range of struct tm's int tm_year, only allowing time_t to represent times from the start of year 1900+INT_MIN to the end of year INT_MAX. The 26-bit number of seconds in a year means that a 64-bit time_t can indeed represent times outside the range of 32-bit years, by a factor of 32 - but the range of representable milliseconds needs ten more bits than that of seconds, so can't reach the ends of the 32-bit year range.)

Given the diversity of ranges, we conservatively estimate the actual supported range by experiment on the first call to qdatetime.cpp's millisInSystemRange() by exploration among the known candidates, converting the result to milliseconds and flagging whether each end is the qint64 range's bound (so millisInSystemRange will know not to try to pad beyond those bounds). The probed date-times are somewhat inside the range, but close enough to the relevant bound that we can be fairly sure the bound is reached, if the probe succeeds.

Definition at line 372 of file qlocaltime.cpp.

References QDateTime::First, QtPrivate::DateTimeConstants::JULIAN_DAY_FOR_EPOCH, QGregorianCalendar::julianFromParts(), QDateTime::Last, QtPrivate::DateTimeConstants::MSECS_PER_SEC, Q_ASSERT, Q_INT64_C, and qMkTime().

Referenced by millisInSystemRange().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getCurrentStandardUtcOffset()

Q_CORE_EXPORT int QLocalTime::getCurrentStandardUtcOffset ( )

Definition at line 199 of file qlocaltime.cpp.

References Q_ASSERT, qDebug, qMkTime(), qTzSet(), QtPrivate::DateTimeConstants::SECS_PER_DAY, QtPrivate::DateTimeConstants::SECS_PER_MIN, and time.

Referenced by getLocalTZA().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getUtcOffset()

Q_CORE_EXPORT int QLocalTime::getUtcOffset ( qint64  atMSecsSinceEpoch)

Definition at line 253 of file qlocaltime.cpp.

References QDateTimePrivate::expressUtcAsLocal(), and QDateTimePrivate::ZoneState::offset.

Referenced by DaylightSavingTA().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ localTimeAbbbreviationAt()

QString QLocalTime::localTimeAbbbreviationAt ( qint64  local,
QDateTimePrivate::DaylightStatus  dst 
)

Definition at line 290 of file qlocaltime.cpp.

References QtPrivate::DateTimeConstants::MSECS_PER_DAY, QtPrivate::DateTimeConstants::MSECS_PER_SEC, Q_ASSERT, and qTzName().

Referenced by QDateTimePrivate::localNameAtMillis().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ mapLocalTime()

QDateTimePrivate::ZoneState QLocalTime::mapLocalTime ( qint64  local,
QDateTimePrivate::DaylightStatus  dst 
)

Definition at line 302 of file qlocaltime.cpp.

References QDateTimePrivate::DaylightTime, QtPrivate::DateTimeConstants::JULIAN_DAY_FOR_EPOCH, QtPrivate::DateTimeConstants::MSECS_PER_SEC, Q_ASSERT, Q_UNLIKELY, QtPrivate::DateTimeConstants::SECS_PER_DAY, and QDateTimePrivate::StandardTime.

Referenced by QDateTimePrivate::localStateAtMillis().

+ Here is the caller graph for this function:

◆ utcToLocal()

QDateTimePrivate::ZoneState QLocalTime::utcToLocal ( qint64  utcMillis)

Definition at line 261 of file qlocaltime.cpp.

References QDateTimePrivate::DaylightTime, QtPrivate::DateTimeConstants::MSECS_PER_SEC, Q_ASSERT, Q_UNLIKELY, qLocalTime(), QtPrivate::DateTimeConstants::SECS_PER_DAY, and QDateTimePrivate::StandardTime.

Referenced by QDateTimePrivate::expressUtcAsLocal().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: