You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
394 lines
22 KiB
394 lines
22 KiB
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
|
|
<!-- /home/espenr/tmp/qt-3.3.8-espenr-2499/qt-x11-free-3.3.8/src/tools/qdatetime.cpp:1239 -->
|
|
<html>
|
|
<head>
|
|
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
|
<title>TQTime Class</title>
|
|
<style type="text/css"><!--
|
|
fn { margin-left: 1cm; text-indent: -1cm; }
|
|
a:link { color: #004faf; text-decoration: none }
|
|
a:visited { color: #672967; text-decoration: none }
|
|
body { background: #ffffff; color: black; }
|
|
--></style>
|
|
</head>
|
|
<body>
|
|
|
|
<table border="0" cellpadding="0" cellspacing="0" width="100%">
|
|
<tr bgcolor="#E5E5E5">
|
|
<td valign=center>
|
|
<a href="index.html">
|
|
<font color="#004faf">Home</font></a>
|
|
| <a href="classes.html">
|
|
<font color="#004faf">All Classes</font></a>
|
|
| <a href="mainclasses.html">
|
|
<font color="#004faf">Main Classes</font></a>
|
|
| <a href="annotated.html">
|
|
<font color="#004faf">Annotated</font></a>
|
|
| <a href="groups.html">
|
|
<font color="#004faf">Grouped Classes</font></a>
|
|
| <a href="functions.html">
|
|
<font color="#004faf">Functions</font></a>
|
|
</td>
|
|
<td align="right" valign="center"><img src="logo32.png" align="right" width="64" height="32" border="0"></td></tr></table><h1 align=center>TQTime Class Reference</h1>
|
|
|
|
<p>The TQTime class provides clock time functions.
|
|
<a href="#details">More...</a>
|
|
<p>All the functions in this class are <a href="threads.html#reentrant">reentrant</a> when TQt is built with thread support.</p>
|
|
<p><tt>#include <<a href="qdatetime-h.html">ntqdatetime.h</a>></tt>
|
|
<p><a href="qtime-members.html">List of all member functions.</a>
|
|
<h2>Public Members</h2>
|
|
<ul>
|
|
<li class=fn><a href="#TQTime"><b>TQTime</b></a> ()</li>
|
|
<li class=fn><a href="#TQTime-2"><b>TQTime</b></a> ( int h, int m, int s = 0, int ms = 0 )</li>
|
|
<li class=fn>bool <a href="#isNull"><b>isNull</b></a> () const</li>
|
|
<li class=fn>bool <a href="#isValid"><b>isValid</b></a> () const</li>
|
|
<li class=fn>int <a href="#hour"><b>hour</b></a> () const</li>
|
|
<li class=fn>int <a href="#minute"><b>minute</b></a> () const</li>
|
|
<li class=fn>int <a href="#second"><b>second</b></a> () const</li>
|
|
<li class=fn>int <a href="#msec"><b>msec</b></a> () const</li>
|
|
<li class=fn>TQString <a href="#toString-2"><b>toString</b></a> ( TQt::DateFormat f = TQt::TextDate ) const</li>
|
|
<li class=fn>TQString <a href="#toString"><b>toString</b></a> ( const TQString & format ) const</li>
|
|
<li class=fn>bool <a href="#setHMS"><b>setHMS</b></a> ( int h, int m, int s, int ms = 0 )</li>
|
|
<li class=fn>TQTime <a href="#addSecs"><b>addSecs</b></a> ( int nsecs ) const</li>
|
|
<li class=fn>int <a href="#secsTo"><b>secsTo</b></a> ( const TQTime & t ) const</li>
|
|
<li class=fn>TQTime <a href="#addMSecs"><b>addMSecs</b></a> ( int ms ) const</li>
|
|
<li class=fn>int <a href="#msecsTo"><b>msecsTo</b></a> ( const TQTime & t ) const</li>
|
|
<li class=fn>bool <a href="#operator-eq-eq"><b>operator==</b></a> ( const TQTime & t ) const</li>
|
|
<li class=fn>bool <a href="#operator!-eq"><b>operator!=</b></a> ( const TQTime & t ) const</li>
|
|
<li class=fn>bool <a href="#operator-lt"><b>operator<</b></a> ( const TQTime & t ) const</li>
|
|
<li class=fn>bool <a href="#operator-lt-eq"><b>operator<=</b></a> ( const TQTime & t ) const</li>
|
|
<li class=fn>bool <a href="#operator-gt"><b>operator></b></a> ( const TQTime & t ) const</li>
|
|
<li class=fn>bool <a href="#operator-gt-eq"><b>operator>=</b></a> ( const TQTime & t ) const</li>
|
|
<li class=fn>void <a href="#start"><b>start</b></a> ()</li>
|
|
<li class=fn>int <a href="#restart"><b>restart</b></a> ()</li>
|
|
<li class=fn>int <a href="#elapsed"><b>elapsed</b></a> () const</li>
|
|
</ul>
|
|
<h2>Static Public Members</h2>
|
|
<ul>
|
|
<li class=fn>TQTime <a href="#currentTime-2"><b>currentTime</b></a> ()</li>
|
|
<li class=fn>TQTime <a href="#currentTime"><b>currentTime</b></a> ( TQt::TimeSpec ts )</li>
|
|
<li class=fn>TQTime <a href="#fromString"><b>fromString</b></a> ( const TQString & s, TQt::DateFormat f = TQt::TextDate )</li>
|
|
<li class=fn>bool <a href="#isValid-2"><b>isValid</b></a> ( int h, int m, int s, int ms = 0 )</li>
|
|
</ul>
|
|
<h2>Related Functions</h2>
|
|
<ul>
|
|
<li class=fn>TQDataStream & <a href="#operator-lt-lt"><b>operator<<</b></a> ( TQDataStream & s, const TQTime & t )</li>
|
|
<li class=fn>TQDataStream & <a href="#operator-gt-gt"><b>operator>></b></a> ( TQDataStream & s, TQTime & t )</li>
|
|
</ul>
|
|
<hr><a name="details"></a><h2>Detailed Description</h2>
|
|
|
|
|
|
|
|
<p> The TQTime class provides clock time functions.
|
|
<p>
|
|
|
|
<p> A TQTime object contains a clock time, i.e. the number of hours,
|
|
minutes, seconds, and milliseconds since midnight. It can read the
|
|
current time from the system clock and measure a span of elapsed
|
|
time. It provides functions for comparing times and for
|
|
manipulating a time by adding a number of (milli)seconds.
|
|
<p> TQTime uses the 24-hour clock format; it has no concept of AM/PM.
|
|
It operates in local time; it knows nothing about time zones or
|
|
daylight savings time.
|
|
<p> A TQTime object is typically created either by giving the number of
|
|
hours, minutes, seconds, and milliseconds explicitly, or by using
|
|
the static function <a href="#currentTime">currentTime</a>(), which creates a TQTime object
|
|
that contains the system's clock time. Note that the accuracy
|
|
depends on the accuracy of the underlying operating system; not
|
|
all systems provide 1-millisecond accuracy.
|
|
<p> The <a href="#hour">hour</a>(), <a href="#minute">minute</a>(), <a href="#second">second</a>(), and <a href="#msec">msec</a>() functions provide
|
|
access to the number of hours, minutes, seconds, and milliseconds
|
|
of the time. The same information is provided in textual format by
|
|
the <a href="#toString">toString</a>() function.
|
|
<p> TQTime provides a full set of operators to compare two TQTime
|
|
objects. One time is considered smaller than another if it is
|
|
earlier than the other.
|
|
<p> The time a given number of seconds or milliseconds later than a
|
|
given time can be found using the <a href="#addSecs">addSecs</a>() or <a href="#addMSecs">addMSecs</a>()
|
|
functions. Correspondingly, the number of (milli)seconds between
|
|
two times can be found using the <a href="#secsTo">secsTo</a>() or <a href="#msecsTo">msecsTo</a>() functions.
|
|
<p> TQTime can be used to measure a span of elapsed time using the
|
|
<a href="#start">start</a>(), <a href="#restart">restart</a>(), and <a href="#elapsed">elapsed</a>() functions.
|
|
<p> <p>See also <a href="qdate.html">TQDate</a>, <a href="ntqdatetime.html">TQDateTime</a>, and <a href="time.html">Time and Date</a>.
|
|
|
|
<hr><h2>Member Function Documentation</h2>
|
|
<h3 class=fn><a name="TQTime"></a>TQTime::TQTime ()
|
|
</h3>
|
|
|
|
<p> Constructs the time 0 hours, minutes, seconds and milliseconds,
|
|
i.e. 00:00:00.000 (midnight). This is a valid time.
|
|
<p> <p>See also <a href="#isValid">isValid</a>().
|
|
|
|
<h3 class=fn><a name="TQTime-2"></a>TQTime::TQTime ( int h, int m, int s = 0, int ms = 0 )
|
|
</h3>
|
|
Constructs a time with hour <em>h</em>, minute <em>m</em>, seconds <em>s</em> and
|
|
milliseconds <em>ms</em>.
|
|
<p> <em>h</em> must be in the range 0..23, <em>m</em> and <em>s</em> must be in the
|
|
range 0..59, and <em>ms</em> must be in the range 0..999.
|
|
<p> <p>See also <a href="#isValid">isValid</a>().
|
|
|
|
<h3 class=fn><a href="qtime.html">TQTime</a> <a name="addMSecs"></a>TQTime::addMSecs ( int ms ) const
|
|
</h3>
|
|
Returns a TQTime object containing a time <em>ms</em> milliseconds later
|
|
than the time of this object (or earlier if <em>ms</em> is negative).
|
|
<p> Note that the time will wrap if it passes midnight. See <a href="#addSecs">addSecs</a>()
|
|
for an example.
|
|
<p> <p>See also <a href="#addSecs">addSecs</a>() and <a href="#msecsTo">msecsTo</a>().
|
|
|
|
<h3 class=fn><a href="qtime.html">TQTime</a> <a name="addSecs"></a>TQTime::addSecs ( int nsecs ) const
|
|
</h3>
|
|
Returns a TQTime object containing a time <em>nsecs</em> seconds later
|
|
than the time of this object (or earlier if <em>nsecs</em> is negative).
|
|
<p> Note that the time will wrap if it passes midnight.
|
|
<p> Example:
|
|
<pre>
|
|
TQTime n( 14, 0, 0 ); // n == 14:00:00
|
|
TQTime t;
|
|
t = n.<a href="#addSecs">addSecs</a>( 70 ); // t == 14:01:10
|
|
t = n.<a href="#addSecs">addSecs</a>( -70 ); // t == 13:58:50
|
|
t = n.<a href="#addSecs">addSecs</a>( 10*60*60 + 5 ); // t == 00:00:05
|
|
t = n.<a href="#addSecs">addSecs</a>( -15*60*60 ); // t == 23:00:00
|
|
</pre>
|
|
|
|
<p> <p>See also <a href="#addMSecs">addMSecs</a>(), <a href="#secsTo">secsTo</a>(), and <a href="ntqdatetime.html#addSecs">TQDateTime::addSecs</a>().
|
|
|
|
<h3 class=fn><a href="qtime.html">TQTime</a> <a name="currentTime"></a>TQTime::currentTime ( <a href="ntqt.html#TimeSpec-enum">TQt::TimeSpec</a> ts )<tt> [static]</tt>
|
|
</h3>
|
|
Returns the current time as reported by the system clock, for the
|
|
TimeSpec <em>ts</em>. The default TimeSpec is LocalTime.
|
|
<p> Note that the accuracy depends on the accuracy of the underlying
|
|
operating system; not all systems provide 1-millisecond accuracy.
|
|
<p> <p>See also <a href="ntqt.html#TimeSpec-enum">TQt::TimeSpec</a>.
|
|
|
|
<p>Examples: <a href="aclock-example.html#x1201">aclock/aclock.cpp</a>, <a href="dclock-example.html#x1104">dclock/dclock.cpp</a>, <a href="tutorial1-12.html#x2398">t12/cannon.cpp</a>, and <a href="tictac-example.html#x40">tictac/tictac.cpp</a>.
|
|
<h3 class=fn><a href="qtime.html">TQTime</a> <a name="currentTime-2"></a>TQTime::currentTime ()<tt> [static]</tt>
|
|
</h3>
|
|
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
|
|
<p> Returns the current time as reported by the system clock.
|
|
<p> Note that the accuracy depends on the accuracy of the underlying
|
|
operating system; not all systems provide 1-millisecond accuracy.
|
|
|
|
<h3 class=fn>int <a name="elapsed"></a>TQTime::elapsed () const
|
|
</h3>
|
|
Returns the number of milliseconds that have elapsed since the
|
|
last time <a href="#start">start</a>() or <a href="#restart">restart</a>() was called.
|
|
<p> Note that the counter wraps to zero 24 hours after the last call
|
|
to start() or restart.
|
|
<p> Note that the accuracy depends on the accuracy of the underlying
|
|
operating system; not all systems provide 1-millisecond accuracy.
|
|
<p> <b>Warning:</b> 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 savings time is turned on
|
|
or off.
|
|
<p> <p>See also <a href="#start">start</a>() and <a href="#restart">restart</a>().
|
|
|
|
<h3 class=fn><a href="qtime.html">TQTime</a> <a name="fromString"></a>TQTime::fromString ( const <a href="ntqstring.html">TQString</a> & s, <a href="ntqt.html#DateFormat-enum">TQt::DateFormat</a> f = TQt::TextDate )<tt> [static]</tt>
|
|
</h3>
|
|
Returns the representation <em>s</em> as a TQTime using the format <em>f</em>,
|
|
or an invalid time if this is not possible.
|
|
<p> <b>Warning:</b> Note that <a href="ntqt.html#DateFormat-enum">TQt::LocalDate</a> cannot be used here.
|
|
|
|
<h3 class=fn>int <a name="hour"></a>TQTime::hour () const
|
|
</h3>
|
|
Returns the hour part (0..23) of the time.
|
|
|
|
<p>Examples: <a href="aclock-example.html#x1202">aclock/aclock.cpp</a> and <a href="tictac-example.html#x41">tictac/tictac.cpp</a>.
|
|
<h3 class=fn>bool <a name="isNull"></a>TQTime::isNull () const
|
|
</h3>
|
|
|
|
<p> Returns TRUE if the time is equal to 00:00:00.000; otherwise
|
|
returns FALSE. A null time is valid.
|
|
<p> <p>See also <a href="#isValid">isValid</a>().
|
|
|
|
<h3 class=fn>bool <a name="isValid"></a>TQTime::isValid () const
|
|
</h3>
|
|
Returns TRUE if the time is valid; otherwise returns FALSE. The
|
|
time 23:30:55.746 is valid, whereas 24:12:30 is invalid.
|
|
<p> <p>See also <a href="#isNull">isNull</a>().
|
|
|
|
<h3 class=fn>bool <a name="isValid-2"></a>TQTime::isValid ( int h, int m, int s, int ms = 0 )<tt> [static]</tt>
|
|
</h3>
|
|
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
|
|
<p> Returns TRUE if the specified time is valid; otherwise returns
|
|
FALSE.
|
|
<p> The time is valid if <em>h</em> is in the range 0..23, <em>m</em> and <em>s</em> are
|
|
in the range 0..59, and <em>ms</em> is in the range 0..999.
|
|
<p> Example:
|
|
<pre>
|
|
TQTime::<a href="#isValid">isValid</a>(21, 10, 30); // returns TRUE
|
|
TQTime::<a href="#isValid">isValid</a>(22, 5, 62); // returns FALSE
|
|
</pre>
|
|
|
|
|
|
<h3 class=fn>int <a name="minute"></a>TQTime::minute () const
|
|
</h3>
|
|
Returns the minute part (0..59) of the time.
|
|
|
|
<p>Examples: <a href="aclock-example.html#x1203">aclock/aclock.cpp</a> and <a href="tictac-example.html#x42">tictac/tictac.cpp</a>.
|
|
<h3 class=fn>int <a name="msec"></a>TQTime::msec () const
|
|
</h3>
|
|
Returns the millisecond part (0..999) of the time.
|
|
|
|
<h3 class=fn>int <a name="msecsTo"></a>TQTime::msecsTo ( const <a href="qtime.html">TQTime</a> & t ) const
|
|
</h3>
|
|
Returns the number of milliseconds from this time to <em>t</em> (which
|
|
is negative if <em>t</em> is earlier than this time).
|
|
<p> Because TQTime measures time within a day and there are 86400
|
|
seconds in a day, the result is always between -86400000 and
|
|
86400000 msec.
|
|
<p> <p>See also <a href="#secsTo">secsTo</a>().
|
|
|
|
<h3 class=fn>bool <a name="operator!-eq"></a>TQTime::operator!= ( const <a href="qtime.html">TQTime</a> & t ) const
|
|
</h3>
|
|
|
|
<p> Returns TRUE if this time is different from <em>t</em>; otherwise returns FALSE.
|
|
|
|
<h3 class=fn>bool <a name="operator-lt"></a>TQTime::operator< ( const <a href="qtime.html">TQTime</a> & t ) const
|
|
</h3>
|
|
|
|
<p> Returns TRUE if this time is earlier than <em>t</em>; otherwise returns FALSE.
|
|
|
|
<h3 class=fn>bool <a name="operator-lt-eq"></a>TQTime::operator<= ( const <a href="qtime.html">TQTime</a> & t ) const
|
|
</h3>
|
|
|
|
<p> Returns TRUE if this time is earlier than or equal to <em>t</em>;
|
|
otherwise returns FALSE.
|
|
|
|
<h3 class=fn>bool <a name="operator-eq-eq"></a>TQTime::operator== ( const <a href="qtime.html">TQTime</a> & t ) const
|
|
</h3>
|
|
|
|
<p> Returns TRUE if this time is equal to <em>t</em>; otherwise returns FALSE.
|
|
|
|
<h3 class=fn>bool <a name="operator-gt"></a>TQTime::operator> ( const <a href="qtime.html">TQTime</a> & t ) const
|
|
</h3>
|
|
|
|
<p> Returns TRUE if this time is later than <em>t</em>; otherwise returns FALSE.
|
|
|
|
<h3 class=fn>bool <a name="operator-gt-eq"></a>TQTime::operator>= ( const <a href="qtime.html">TQTime</a> & t ) const
|
|
</h3>
|
|
|
|
<p> Returns TRUE if this time is later than or equal to <em>t</em>;
|
|
otherwise returns FALSE.
|
|
|
|
<h3 class=fn>int <a name="restart"></a>TQTime::restart ()
|
|
</h3>
|
|
Sets this time to the current time and returns the number of
|
|
milliseconds that have elapsed since the last time <a href="#start">start</a>() or
|
|
<a href="#restart">restart</a>() was called.
|
|
<p> This function is guaranteed to be atomic and is thus very handy
|
|
for repeated measurements. Call start() to start the first
|
|
measurement and then restart() for each later measurement.
|
|
<p> Note that the counter wraps to zero 24 hours after the last call
|
|
to start() or restart().
|
|
<p> <b>Warning:</b> 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 savings time is turned on
|
|
or off.
|
|
<p> <p>See also <a href="#start">start</a>(), <a href="#elapsed">elapsed</a>(), and <a href="#currentTime">currentTime</a>().
|
|
|
|
<h3 class=fn>int <a name="second"></a>TQTime::second () const
|
|
</h3>
|
|
Returns the second part (0..59) of the time.
|
|
|
|
<p>Example: <a href="tictac-example.html#x43">tictac/tictac.cpp</a>.
|
|
<h3 class=fn>int <a name="secsTo"></a>TQTime::secsTo ( const <a href="qtime.html">TQTime</a> & t ) const
|
|
</h3>
|
|
Returns the number of seconds from this time to <em>t</em> (which is
|
|
negative if <em>t</em> is earlier than this time).
|
|
<p> Because TQTime measures time within a day and there are 86400
|
|
seconds in a day, the result is always between -86400 and 86400.
|
|
<p> <p>See also <a href="#addSecs">addSecs</a>() and <a href="ntqdatetime.html#secsTo">TQDateTime::secsTo</a>().
|
|
|
|
<p>Example: <a href="tutorial1-12.html#x2399">t12/cannon.cpp</a>.
|
|
<h3 class=fn>bool <a name="setHMS"></a>TQTime::setHMS ( int h, int m, int s, int ms = 0 )
|
|
</h3>
|
|
Sets the time to hour <em>h</em>, minute <em>m</em>, seconds <em>s</em> and
|
|
milliseconds <em>ms</em>.
|
|
<p> <em>h</em> must be in the range 0..23, <em>m</em> and <em>s</em> must be in the
|
|
range 0..59, and <em>ms</em> must be in the range 0..999. Returns TRUE
|
|
if the set time is valid; otherwise returns FALSE.
|
|
<p> <p>See also <a href="#isValid">isValid</a>().
|
|
|
|
<h3 class=fn>void <a name="start"></a>TQTime::start ()
|
|
</h3>
|
|
Sets this time to the current time. This is practical for timing:
|
|
<p> <pre>
|
|
TQTime t;
|
|
t.<a href="#start">start</a>();
|
|
some_lengthy_task();
|
|
<a href="ntqapplication.html#qDebug">qDebug</a>( "Time elapsed: %d ms", t.<a href="#elapsed">elapsed</a>() );
|
|
</pre>
|
|
|
|
<p> <p>See also <a href="#restart">restart</a>(), <a href="#elapsed">elapsed</a>(), and <a href="#currentTime">currentTime</a>().
|
|
|
|
<h3 class=fn><a href="ntqstring.html">TQString</a> <a name="toString"></a>TQTime::toString ( const <a href="ntqstring.html">TQString</a> & format ) const
|
|
</h3>
|
|
Returns the time as a string. The <em>format</em> parameter determines
|
|
the format of the result string.
|
|
<p> These expressions may be used:
|
|
<p> <center><table cellpadding="4" cellspacing="2" border="0">
|
|
<tr bgcolor="#a2c511"> <th valign="top">Expression <th valign="top">Output
|
|
<tr bgcolor="#f0f0f0"> <td valign="top">h
|
|
<td valign="top">the hour without a leading zero (0..23 or 1..12 if AM/PM display)
|
|
<tr bgcolor="#d0d0d0"> <td valign="top">hh
|
|
<td valign="top">the hour with a leading zero (00..23 or 01..12 if AM/PM display)
|
|
<tr bgcolor="#f0f0f0"> <td valign="top">m <td valign="top">the minute without a leading zero (0..59)
|
|
<tr bgcolor="#d0d0d0"> <td valign="top">mm <td valign="top">the minute with a leading zero (00..59)
|
|
<tr bgcolor="#f0f0f0"> <td valign="top">s <td valign="top">the second whithout a leading zero (0..59)
|
|
<tr bgcolor="#d0d0d0"> <td valign="top">ss <td valign="top">the second whith a leading zero (00..59)
|
|
<tr bgcolor="#f0f0f0"> <td valign="top">z <td valign="top">the milliseconds without leading zeroes (0..999)
|
|
<tr bgcolor="#d0d0d0"> <td valign="top">zzz <td valign="top">the milliseconds with leading zeroes (000..999)
|
|
<tr bgcolor="#f0f0f0"> <td valign="top">AP
|
|
<td valign="top">use AM/PM display. <em>AP</em> will be replaced by either "AM" or "PM".
|
|
<tr bgcolor="#d0d0d0"> <td valign="top">ap
|
|
<td valign="top">use am/pm display. <em>ap</em> will be replaced by either "am" or "pm".
|
|
</table></center>
|
|
<p> All other input characters will be ignored.
|
|
<p> Example format strings (assuming that the TQTime is 14:13:09.042)
|
|
<p> <center><table cellpadding="4" cellspacing="2" border="0">
|
|
<tr bgcolor="#a2c511"> <th valign="top">Format <th valign="top">Result
|
|
<tr bgcolor="#f0f0f0"> <td valign="top">hh:mm:ss.zzz <td valign="top" colspan="1" rowspan="1"> 14:13:09.042
|
|
<tr bgcolor="#d0d0d0"> <td valign="top">h:m:s ap <td valign="top" colspan="1" rowspan="1"> 2:13:9 pm
|
|
</table></center>
|
|
<p> If the time is an invalid time, then <a href="ntqstring.html#TQString-null">TQString::null</a> will be returned.
|
|
<p> <p>See also <a href="qdate.html#toString">TQDate::toString</a>() and <a href="ntqdatetime.html#toString">TQDateTime::toString</a>().
|
|
|
|
<h3 class=fn><a href="ntqstring.html">TQString</a> <a name="toString-2"></a>TQTime::toString ( <a href="ntqt.html#DateFormat-enum">TQt::DateFormat</a> f = TQt::TextDate ) const
|
|
</h3>
|
|
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
|
|
<p> Returns the time as a string. Milliseconds are not included. The
|
|
<em>f</em> parameter determines the format of the string.
|
|
<p> If <em>f</em> is <a href="ntqt.html#DateFormat-enum">TQt::TextDate</a>, the string format is HH:MM:SS; e.g. 1
|
|
second before midnight would be "23:59:59".
|
|
<p> If <em>f</em> is <a href="ntqt.html#DateFormat-enum">TQt::ISODate</a>, the string format corresponds to the
|
|
ISO 8601 extended specification for representations of dates,
|
|
which is also HH:MM:SS.
|
|
<p> If <em>f</em> is TQt::LocalDate, the string format depends on the locale
|
|
settings of the system.
|
|
<p> If the time is an invalid time, then <a href="ntqstring.html#TQString-null">TQString::null</a> will be returned.
|
|
|
|
<hr><h2>Related Functions</h2>
|
|
<h3 class=fn><a href="ntqdatastream.html">TQDataStream</a> & <a name="operator-lt-lt"></a>operator<< ( <a href="ntqdatastream.html">TQDataStream</a> & s, const <a href="qtime.html">TQTime</a> & t )
|
|
</h3>
|
|
|
|
<p> Writes time <em>t</em> to the stream <em>s</em>.
|
|
<p> <p>See also <a href="datastreamformat.html">Format of the TQDataStream operators</a>.
|
|
|
|
<h3 class=fn><a href="ntqdatastream.html">TQDataStream</a> & <a name="operator-gt-gt"></a>operator>> ( <a href="ntqdatastream.html">TQDataStream</a> & s, <a href="qtime.html">TQTime</a> & t )
|
|
</h3>
|
|
|
|
<p> Reads a time from the stream <em>s</em> into <em>t</em>.
|
|
<p> <p>See also <a href="datastreamformat.html">Format of the TQDataStream operators</a>.
|
|
|
|
<!-- eof -->
|
|
<hr><p>
|
|
This file is part of the <a href="index.html">TQt toolkit</a>.
|
|
Copyright © 1995-2007
|
|
<a href="http://www.trolltech.com/">Trolltech</a>. All Rights Reserved.<p><address><hr><div align=center>
|
|
<table width=100% cellspacing=0 border=0><tr>
|
|
<td>Copyright © 2007
|
|
<a href="troll.html">Trolltech</a><td align=center><a href="trademarks.html">Trademarks</a>
|
|
<td align=right><div align=right>TQt 3.3.8</div>
|
|
</table></div></address></body>
|
|
</html>
|