PythonQt.QtCore.QTime · declarations 001
addMSecs
addMSecs(ms: int) -> Any
X.addMSecs(ms) -> PythonQt.QtCore.QTime
Supplemental documentation: Qt 5 reference:
QTime QTime::addMSecs(int ms) const
Returns a QTime object containing a time ms milliseconds later than the time of this object (or earlier if ms is negative).
Note that the time will wrap if it passes midnight. See addSecs() for an example.
Returns a null time if this time is invalid.
See also addSecs(), msecsTo(), and QDateTime::addMSecs().
Upstream PySide2 reference signatures (binding differences may apply):
addMSecs(self, ms: int) -> PySide2.QtCore.QTime
Source: https://doc.qt.io/archives/qt-5.15/qtime.html#addMSecs
addSecs
addSecs(secs: int) -> Any
X.addSecs(secs) -> PythonQt.QtCore.QTime
Supplemental documentation: Qt 5 reference:
QTime QTime::addSecs(int s) const
Returns a QTime object containing a time s seconds later than the time of this object (or earlier if s is negative).
Note that the time will wrap if it passes midnight.
Returns a null time if this time is invalid.
Example:
QTime n(14, 0, 0); // n == 14:00:00
QTime t;
t = n.addSecs(70); // t == 14:01:10
t = n.addSecs(-70); // t == 13:58:50
t = n.addSecs(10 * 60 * 60 + 5); // t == 00:00:05
t = n.addSecs(-15 * 60 * 60); // t == 23:00:00
See also addMSecs(), secsTo(), and QDateTime::addSecs().
Upstream PySide2 reference signatures (binding differences may apply):
addSecs(self, secs: int) -> PySide2.QtCore.QTime
Source: https://doc.qt.io/archives/qt-5.15/qtime.html#addSecs
currentTime
currentTime() -> Any
X.currentTime() -> PythonQt.QtCore.QTime
Supplemental documentation: Qt 5 reference:
[static] QTime QTime::currentTime()
Returns the current time as reported by the system clock.
Note that the accuracy depends on the accuracy of the underlying operating system; not all systems provide 1-millisecond accuracy.
Furthermore, currentTime() only increases within each day; it shall drop by 24 hours each time midnight passes; and, beside this, changes in it may not correspond to elapsed time, if a daylight-saving transition intervenes.
See also QDateTime::currentDateTime() and QDateTime::currentDateTimeUtc().
Upstream PySide2 reference signatures (binding differences may apply):
currentTime() -> PySide2.QtCore.QTime
Source: https://doc.qt.io/archives/qt-5.15/qtime.html#currentTime
elapsed
elapsed() -> int
X.elapsed() -> int
Upstream PySide2 reference signatures (binding differences may apply):
elapsed(self) -> int
Source: https://doc.qt.io/archives/qt-5.15/qtime.html#elapsed
fromMSecsSinceStartOfDay
fromMSecsSinceStartOfDay(msecs: int) -> Any
X.fromMSecsSinceStartOfDay(msecs) -> PythonQt.QtCore.QTime
Supplemental documentation: Qt 5 reference:
[static] QTime QTime::fromMSecsSinceStartOfDay(int msecs)
Returns a new QTime instance with the time set to the number of msecs since the start of the day, i.e. since 00:00:00.
If msecs falls outside the valid range an invalid QTime will be returned.
See also msecsSinceStartOfDay().
Upstream PySide2 reference signatures (binding differences may apply):
fromMSecsSinceStartOfDay(msecs: int) -> PySide2.QtCore.QTime
Source: https://doc.qt.io/archives/qt-5.15/qtime.html#fromMSecsSinceStartOfDay
fromString
fromString(s: str, f: Any) -> Any
X.fromString(s, f) -> PythonQt.QtCore.QTime
Supplemental documentation: Qt 5 reference:
[static] QTime QTime::fromString(const QString \&string, Qt::DateFormat format \= Qt::TextDate)
Returns the time represented in the string as a QTime using the format given, or an invalid time if this is not possible.
Note that fromString() uses a "C" locale encoded string to convert milliseconds to a float value. If the default locale is not "C", this may result in two conversion attempts (if the conversion fails for the default locale). This should be considered an implementation detail.
Note: Support for localized dates, including the format options Qt::SystemLocaleDate, Qt::SystemLocaleShortDate, Qt::SystemLocaleLongDate, Qt::LocaleDate, Qt::DefaultLocaleShortDate, and Qt::DefaultLocaleLongDate, shall be removed in Qt 6. Use QLocale::toTime() instead.
See also toString() and QLocale::toTime().
[static] QTime QTime::fromString(const QString \&string, const QString \&format)
Returns the QTime represented by the string, using the format given, or an invalid time if the string cannot be parsed.
These expressions may be used for the format:
| Expression | Output |
|---|---|
| h | The hour without a leading zero (0 to 23 or 1 to 12 if AM/PM display) |
| hh | The hour with a leading zero (00 to 23 or 01 to 12 if AM/PM display) |
| H | The hour without a leading zero (0 to 23, even with AM/PM display) |
| HH | The hour with a leading zero (00 to 23, even with AM/PM display) |
| m | The minute without a leading zero (0 to 59) |
| mm | The minute with a leading zero (00 to 59) |
| s | The whole second, without any leading zero (0 to 59) |
| ss | The whole second, with a leading zero where applicable (00 to 59) |
| z | The fractional part of the second, to go after a decimal point, without trailing zeroes (0 to 999). Thus "s.z" reports the seconds to full available (millisecond) precision without trailing zeroes. |
| zzz | The fractional part of the second, to millisecond precision, including trailing zeroes where applicable (000 to 999). |
| AP or A | Interpret as an AM/PM time. A/AP will match an upper-case version of either QLocale::amText() or QLocale::pmText(). |
| ap or a | Interpret as an am/pm time. a/ap will match a lower-case version of either QLocale::amText() or QLocale::pmText(). |
All other input characters will be treated as text. Any non-empty sequence of characters enclosed in single quotes will also be treated (stripped of the quotes) as text and not be interpreted as expressions.
QTime time = QTime::fromString("1mm12car00", "m'mm'hcarss");
// time is 12:01.00
If the format is not satisfied, an invalid QTime is returned. Expressions that do not expect leading zeroes to be given (h, m, s and z) are greedy. This means that they will use two digits even if this puts them outside the range of accepted values and leaves too few digits for other sections. For example, the following string could have meant 00:07:10, but the m will grab two digits, resulting in an invalid time:
QTime time = QTime::fromString("00:710", "hh:ms"); // invalid
Any field that is not represented in the format will be set to zero. For example:
QTime time = QTime::fromString("1.30", "m.s");
// time is 00:01:30.000
Note: If localized forms of am or pm (the AP, ap, A or a formats) are used, please switch to using QLocale::system().toTime() as QTime methods shall change to only recognize English (C locale) at Qt 6.
See also toString(), QDateTime::fromString(), QDate::fromString(), and QLocale::toTime().
Upstream PySide2 reference signatures (binding differences may apply):
fromString(s: str, f: PySide2.QtCore.Qt.DateFormat=...) -> PySide2.QtCore.QTime
fromString(s: str, format: str) -> PySide2.QtCore.QTime
Source: https://doc.qt.io/archives/qt-5.15/qtime.html#fromString
hour
hour() -> int
X.hour() -> int
Supplemental documentation: Qt 5 reference:
int QTime::hour() const
Returns the hour part (0 to 23) of the time.
Returns -1 if the time is invalid.
See also minute(), second(), and msec().
Upstream PySide2 reference signatures (binding differences may apply):
hour(self) -> int
Source: https://doc.qt.io/archives/qt-5.15/qtime.html#hour
isNull
isNull() -> bool
X.isNull() -> bool
Supplemental documentation: Qt 5 reference:
bool QTime::isNull() const
Returns true if the time is null (i.e., the
QTime object was constructed using the
default constructor); otherwise returns false. A null time is also an invalid time.
See also isValid().
Upstream PySide2 reference signatures (binding differences may apply):
isNull(self) -> bool
Source: https://doc.qt.io/archives/qt-5.15/qtime.html#isNull
isValid
isValid(m: Any, s: Any, ms: Any) -> bool
X.isValid(m, s, ms) -> bool
Supplemental documentation: Qt 5 reference:
bool QTime::isValid() const
Returns true if the time is valid; otherwise returns false. For example, the time
23:30:55.746 is valid, but 24:12:30 is invalid.
See also isNull().
[static] bool QTime::isValid(int h, int m, int s, int ms \= 0)
This is an overloaded function.
Returns true if the specified time is valid; otherwise returns false.
The time is valid if h is in the range 0 to 23, m and s are in the range 0 to 59, and ms is in the range 0 to 999.
Example:
QTime::isValid(21, 10, 30); // returns true
QTime::isValid(22, 5, 62); // returns false
Upstream PySide2 reference signatures (binding differences may apply):
isValid(h: int, m: int, s: int, ms: int=...) -> bool
isValid(self) -> bool
Source: https://doc.qt.io/archives/qt-5.15/qtime.html#isValid
minute
minute() -> int
X.minute() -> int
Supplemental documentation: Qt 5 reference:
int QTime::minute() const
Returns the minute part (0 to 59) of the time.
Returns -1 if the time is invalid.
See also hour(), second(), and msec().
Upstream PySide2 reference signatures (binding differences may apply):
minute(self) -> int
Source: https://doc.qt.io/archives/qt-5.15/qtime.html#minute
msec
msec() -> int
X.msec() -> int
Supplemental documentation: Qt 5 reference:
int QTime::msec() const
Returns the millisecond part (0 to 999) of the time.
Returns -1 if the time is invalid.
See also hour(), minute(), and second().
Upstream PySide2 reference signatures (binding differences may apply):
msec(self) -> int
Source: https://doc.qt.io/archives/qt-5.15/qtime.html#msec
msecsSinceStartOfDay
msecsSinceStartOfDay() -> int
X.msecsSinceStartOfDay() -> int
Supplemental documentation: Qt 5 reference:
int QTime::msecsSinceStartOfDay() const
Returns the number of msecs since the start of the day, i.e. since 00:00:00.
See also fromMSecsSinceStartOfDay().
Upstream PySide2 reference signatures (binding differences may apply):
msecsSinceStartOfDay(self) -> int
Source: https://doc.qt.io/archives/qt-5.15/qtime.html#msecsSinceStartOfDay
msecsTo
msecsTo(arg__1: Any) -> int
X.msecsTo(arg__1) -> int
Supplemental documentation: Qt 5 reference:
int QTime::msecsTo(const QTime \&t) const
Returns the number of milliseconds from this time to t. If t is earlier than this time, the number of milliseconds returned is negative.
Because QTime measures time within a day and there are 86400 seconds in a day, the result is always between -86400000 and 86400000 ms.
Returns 0 if either time is invalid.
See also secsTo(), addMSecs(), and QDateTime::msecsTo().
Upstream PySide2 reference signatures (binding differences may apply):
msecsTo(self, arg__1: PySide2.QtCore.QTime) -> int
Source: https://doc.qt.io/archives/qt-5.15/qtime.html#msecsTo
restart
restart() -> int
X.restart() -> int
Supplemental documentation: Qt 5 reference:
int QTime::restart()
Sets this time to the current time and returns the number of milliseconds that have elapsed since the last time start() or restart() was called.
This function is guaranteed to be atomic and is thus very handy for repeated measurements. Call start() to start the first measurement, and restart() for each later measurement.
Note that the counter wraps to zero 24 hours after the last call to start() or restart().
Warning: If the system's clock setting has been changed since the last time start() or restart() was called, the result is undefined. This can happen when daylight-saving time is turned on or off.
See also start(), elapsed(), and currentTime().
Upstream PySide2 reference signatures (binding differences may apply):
restart(self) -> int
Source: https://doc.qt.io/archives/qt-5.15/qtime.html#restart
second
second() -> int
X.second() -> int
Supplemental documentation: Qt 5 reference:
int QTime::second() const
Returns the second part (0 to 59) of the time.
Returns -1 if the time is invalid.
See also hour(), minute(), and msec().
Upstream PySide2 reference signatures (binding differences may apply):
second(self) -> int
Source: https://doc.qt.io/archives/qt-5.15/qtime.html#second
secsTo
secsTo(arg__1: Any) -> int
X.secsTo(arg__1) -> int
Supplemental documentation: Qt 5 reference:
int QTime::secsTo(const QTime \&t) const
Returns the number of seconds from this time to t. If t is earlier than this time, the number of seconds returned is negative.
Because QTime measures time within a day and there are 86400 seconds in a day, the result is always between -86400 and 86400.
secsTo() does not take into account any milliseconds.
Returns 0 if either time is invalid.
See also addSecs() and QDateTime::secsTo().
Upstream PySide2 reference signatures (binding differences may apply):
secsTo(self, arg__1: PySide2.QtCore.QTime) -> int
Source: https://doc.qt.io/archives/qt-5.15/qtime.html#secsTo
setHMS
setHMS(h: int, m: int, s: int, ms: int) -> bool
X.setHMS(h, m, s, ms) -> bool
Supplemental documentation: Qt 5 reference:
bool QTime::setHMS(int h, int m, int s, int ms \= 0)
Sets the time to hour h, minute m, seconds s and milliseconds ms.
h must be in the range 0 to 23, m and s must be in the range 0 to 59, and ms
must be in the range 0 to 999. Returns true if the set time is valid; otherwise
returns false.
See also isValid().
Upstream PySide2 reference signatures (binding differences may apply):
setHMS(self, h: int, m: int, s: int, ms: int=...) -> bool
Source: https://doc.qt.io/archives/qt-5.15/qtime.html#setHMS
start
start() -> None
X.start()
Upstream PySide2 reference signatures (binding differences may apply):
start(self) -> None
Source: https://doc.qt.io/archives/qt-5.15/qtime.html#start
toString
toString(f: Any) -> str
X.toString(f) -> str
Supplemental documentation: Qt 5 reference:
QString QTime::toString(QStringView format) const
QString QTime::toString(const QString \&format) const
QString QTime::toString(Qt::DateFormat format \= Qt::TextDate) const
This is an overloaded function.
Returns the time as a string. The format parameter determines the format of the string.
If format is Qt::TextDate, the string format is HH:mm:ss; e.g. 1 second before midnight would be "23:59:59".
If format is Qt::ISODate, the string format corresponds to the ISO 8601 extended specification for representations of dates, represented by HH:mm:ss. To include milliseconds in the ISO 8601 date, use the format Qt::ISODateWithMs, which corresponds to HH:mm:ss.zzz.
The format options Qt::SystemLocaleDate:, Qt::SystemLocaleShortDate and Qt::SystemLocaleLongDate shall be removed in Qt 6. Their use should be replaced with: QLocale::system().toString(time, QLocale::ShortFormat) or QLocale::system().toString(time, QLocale::LongFormat).
The format options Qt::LocaleDate, Qt::DefaultLocaleShortDate and Qt::DefaultLocaleLongDate shall be removed in Qt 6. Their use should be replaced with: QLocale().toString(time, QLocale::ShortFormat) or QLocale().toString(time, QLocale::LongFormat).
If the format is Qt::RFC2822Date, the string is formatted in an RFC 2822 compatible way. An example of this formatting is "23:59:20".
If the time is invalid, an empty string will be returned.
See also fromString(), QDate::toString(), QDateTime::toString(), and QLocale::toString().
Upstream PySide2 reference signatures (binding differences may apply):
toString(self, f: PySide2.QtCore.Qt.DateFormat=...) -> str
toString(self, format: str) -> str
Source: https://doc.qt.io/archives/qt-5.15/qtime.html#toString