Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
QDateTimePrivate Class Reference

#include <qdatetime_p.h>

+ Inheritance diagram for QDateTimePrivate:
+ Collaboration diagram for QDateTimePrivate:

Classes

struct  ZoneState
 

Public Types

enum  Spec {
  LocalUnknown = -1 , LocalStandard = 0 , LocalDST = 1 , UTC = 2 ,
  OffsetFromUTC = 3 , TimeZone = 4
}
 
enum  DaylightStatus { UnknownDaylightTime = -1 , StandardTime = 0 , DaylightTime = 1 }
 
enum  StatusFlag {
  ShortData = 0x01 , ValidDate = 0x02 , ValidTime = 0x04 , ValidDateTime = 0x08 ,
  TimeSpecMask = 0x30 , SetToStandardTime = 0x40 , SetToDaylightTime = 0x80 , ValidityMask = ValidDate | ValidTime | ValidDateTime ,
  DaylightMask = SetToStandardTime | SetToDaylightTime
}
 
enum  TransitionOption {
  GapUseBefore = 2 , GapUseAfter = 4 , FoldUseBefore = 0x20 , FoldUseAfter = 0x40 ,
  FlipForReverseDst = 0x400 , GapMask = GapUseBefore | GapUseAfter , FoldMask = FoldUseBefore | FoldUseAfter
}
 
enum  { TimeSpecShift = 4 }
 
typedef QDateTime::ShortData QDateTimeShortData
 
typedef QDateTime::Data QDateTimeData
 

Static Public Member Functions

static QDateTime::Data create (QDate toDate, QTime toTime, const QTimeZone &timeZone, QDateTime::TransitionResolution resolve)
 
static ZoneState expressUtcAsLocal (qint64 utcMSecs)
 
static ZoneState localStateAtMillis (qint64 millis, TransitionOptions resolve)
 
static QString localNameAtMillis (qint64 millis, DaylightStatus dst)
 

Public Attributes

StatusFlags m_status = StatusFlag(Qt::LocalTime << TimeSpecShift)
 
qint64 m_msecs = 0
 
int m_offsetFromUtc = 0
 
QTimeZone m_timeZone
 
- Public Attributes inherited from QSharedData
QAtomicInt ref
 

Additional Inherited Members

- Public Member Functions inherited from QSharedData
 QSharedData () noexcept
 Constructs a QSharedData object with a reference count of 0.
 
 QSharedData (const QSharedData &) noexcept
 Constructs a QSharedData object with reference count 0.
 
QSharedDataoperator= (const QSharedData &)=delete
 
 ~QSharedData ()=default
 

Detailed Description

Definition at line 34 of file qdatetime_p.h.

Member Typedef Documentation

◆ QDateTimeData

typedef QDateTime::Data QDateTimePrivate::QDateTimeData

Definition at line 39 of file qdatetime_p.h.

◆ QDateTimeShortData

typedef QDateTime::ShortData QDateTimePrivate::QDateTimeShortData

Definition at line 38 of file qdatetime_p.h.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
Enumerator
TimeSpecShift 

Definition at line 92 of file qdatetime_p.h.

◆ DaylightStatus

Enumerator
UnknownDaylightTime 
StandardTime 
DaylightTime 

Definition at line 53 of file qdatetime_p.h.

◆ Spec

Enumerator
LocalUnknown 
LocalStandard 
LocalDST 
UTC 
OffsetFromUTC 
TimeZone 

Definition at line 43 of file qdatetime_p.h.

◆ StatusFlag

Enumerator
ShortData 
ValidDate 
ValidTime 
ValidDateTime 
TimeSpecMask 
SetToStandardTime 
SetToDaylightTime 
ValidityMask 
DaylightMask 

Definition at line 60 of file qdatetime_p.h.

◆ TransitionOption

This enumeration is used to resolve datetime combinations which fall in \l {Timezone transitions}. The transition is described as a "gap" if there are time representations skipped over by the zone, as is common in the "spring forward" transitions in many zones on entering daylight-saving time. The transition is described as a "fold" if there are time representations repeated in the zone, as in a "fall back" transition out of daylight-saving time.

When the options specified do not determine a resolution for a datetime, it is marked invalid.

The prepared option sets above are in fact composed from low-level atomic options. For each of gap and fold you can chose between two candidate times, one before or after the transition, based on the time requested; or you can pick the moment of transition, or the start or end of the transition interval. For a gap, the start and end of the interval are the moment of the transition, but for a repeated interval the start of the first pass is the start of the transition interval, the end of the second pass is the end of the transition interval and the moment of the transition itself is both the end of the first pass and the start of the second.

\value GapUseBefore For a time in a gap, use a time before the transition, as if stepping back from a later time. \value GapUseAfter For a time in a gap, use a time after the transition, as if stepping forward from an earlier time. \value FoldUseBefore For a repeated time, use the first candidate, which is before the transition. \value FoldUseAfter For a repeated time, use the second candidate, which is after the transition. \value FlipForReverseDst For "reversed" DST, this reverses the preceding four options (see below).

The last has no effect unless the "daylight-saving" time side of the transition is known to have a lower offset from UTC than the standard time side. (This is the "reversed" DST case of \l {Timezone transitions}.) In that case, if other options would select a time after the transition, a time before is used instead, and vice versa. This effectively turns a preference for the side with lower offset into a preference for the side that is officially standard time, even if it has higher offset; and conversely a preference for higher offset into a preference for daylight-saving time, even if it has a lower offset. This option has no effect on a resolution that selects the moment of transition or the start or end of the transition interval.

The result of combining more than one of the GapUse* options is undefined; likewise for the FoldUse*. Each of QDateTime's TransitionResolution values, aside from Reject, maps to a combination that incorporates one from each of these sets.

Enumerator
GapUseBefore 
GapUseAfter 
FoldUseBefore 
FoldUseAfter 
FlipForReverseDst 
GapMask 
FoldMask 

Definition at line 77 of file qdatetime_p.h.

Member Function Documentation

◆ create()

Q_NEVER_INLINE QDateTime::Data QDateTimePrivate::create ( QDate toDate,
QTime toTime,
const QTimeZone & timeZone,
QDateTime::TransitionResolution resolve )
static

Definition at line 3544 of file qdatetime.cpp.

References refreshSimpleDateTime(), refreshZonedDateTime(), resolve(), setDateTime(), toDate(), toTime(), and toTransitionOptions().

+ Here is the call graph for this function:

◆ expressUtcAsLocal()

QDateTimePrivate::ZoneState QDateTimePrivate::expressUtcAsLocal ( qint64 utcMSecs)
static

Definition at line 2812 of file qdatetime.cpp.

References DaylightTime, QGregorianCalendar::julianFromParts(), millisInSystemRange(), QtPrivate::DateTimeConstants::MSECS_PER_SEC, msecsToJulianDay(), QGregorianCalendar::partsFromJulian(), Q_UNLIKELY, qAddOverflow(), qMulOverflow(), qSubOverflow(), StandardTime, systemTimeYearMatching(), and QLocalTime::utcToLocal().

Referenced by QLocalTime::getUtcOffset(), and QDateTime::setMSecsSinceEpoch().

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

◆ localNameAtMillis()

QString QDateTimePrivate::localNameAtMillis ( qint64 millis,
DaylightStatus dst )
static

Definition at line 2962 of file qdatetime.cpp.

References QString::isEmpty(), QLocalTime::localTimeAbbbreviationAt(), millisInSystemRange(), millisToWithinRange(), QtPrivate::DateTimeConstants::MSECS_PER_DAY, QtPrivate::DateTimeConstants::MSECS_PER_SEC, Q_LIKELY, resolve(), state, and toTransitionOptions().

Referenced by QDateTime::timeZoneAbbreviation().

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

◆ localStateAtMillis()

QDateTimePrivate::ZoneState QDateTimePrivate::localStateAtMillis ( qint64 millis,
TransitionOptions resolve )
static

Definition at line 2994 of file qdatetime.cpp.

References QLocalTime::mapLocalTime(), millisInSystemRange(), millisToWithinRange(), QtPrivate::DateTimeConstants::MSECS_PER_DAY, Q_LIKELY, Q_UNLIKELY, qAddOverflow(), and resolve().

Referenced by QDateTime::isDaylightTime(), QDateTime::offsetFromUtc(), stateAtMillis(), and QDateTime::toMSecsSinceEpoch().

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

Member Data Documentation

◆ m_msecs

qint64 QDateTimePrivate::m_msecs = 0

Definition at line 121 of file qdatetime_p.h.

Referenced by QDateTime::setMSecsSinceEpoch(), and QDateTime::toMSecsSinceEpoch().

◆ m_offsetFromUtc

int QDateTimePrivate::m_offsetFromUtc = 0

◆ m_status

StatusFlags QDateTimePrivate::m_status = StatusFlag(Qt::LocalTime << TimeSpecShift)

Definition at line 120 of file qdatetime_p.h.

Referenced by QDateTime::setMSecsSinceEpoch().

◆ m_timeZone


The documentation for this class was generated from the following files: