summaryrefslogtreecommitdiffstats
path: root/doc/html/tqtime.html
blob: 3e1159a19e6a8ba67487ec58730c0ef5a4a8b307 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<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&nbsp;Classes</font></a>
 | <a href="mainclasses.html">
<font color="#004faf">Main&nbsp;Classes</font></a>
 | <a href="annotated.html">
<font color="#004faf">Annotated</font></a>
 | <a href="groups.html">
<font color="#004faf">Grouped&nbsp;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 &lt;<a href="tqdatetime-h.html">tqdatetime.h</a>&gt;</tt>
<p><a href="tqtime-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&nbsp;h, int&nbsp;m, int&nbsp;s = 0, int&nbsp;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&nbsp;f = TQt::TextDate ) const</li>
<li class=fn>TQString <a href="#toString"><b>toString</b></a> ( const&nbsp;TQString&nbsp;&amp;&nbsp;format ) const</li>
<li class=fn>bool <a href="#setHMS"><b>setHMS</b></a> ( int&nbsp;h, int&nbsp;m, int&nbsp;s, int&nbsp;ms = 0 )</li>
<li class=fn>TQTime <a href="#addSecs"><b>addSecs</b></a> ( int&nbsp;nsecs ) const</li>
<li class=fn>int <a href="#secsTo"><b>secsTo</b></a> ( const&nbsp;TQTime&nbsp;&amp;&nbsp;t ) const</li>
<li class=fn>TQTime <a href="#addMSecs"><b>addMSecs</b></a> ( int&nbsp;ms ) const</li>
<li class=fn>int <a href="#msecsTo"><b>msecsTo</b></a> ( const&nbsp;TQTime&nbsp;&amp;&nbsp;t ) const</li>
<li class=fn>bool <a href="#operator-eq-eq"><b>operator==</b></a> ( const&nbsp;TQTime&nbsp;&amp;&nbsp;t ) const</li>
<li class=fn>bool <a href="#operator!-eq"><b>operator!=</b></a> ( const&nbsp;TQTime&nbsp;&amp;&nbsp;t ) const</li>
<li class=fn>bool <a href="#operator-lt"><b>operator&lt;</b></a> ( const&nbsp;TQTime&nbsp;&amp;&nbsp;t ) const</li>
<li class=fn>bool <a href="#operator-lt-eq"><b>operator&lt;=</b></a> ( const&nbsp;TQTime&nbsp;&amp;&nbsp;t ) const</li>
<li class=fn>bool <a href="#operator-gt"><b>operator&gt;</b></a> ( const&nbsp;TQTime&nbsp;&amp;&nbsp;t ) const</li>
<li class=fn>bool <a href="#operator-gt-eq"><b>operator&gt;=</b></a> ( const&nbsp;TQTime&nbsp;&amp;&nbsp;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&nbsp;ts )</li>
<li class=fn>TQTime <a href="#fromString"><b>fromString</b></a> ( const&nbsp;TQString&nbsp;&amp;&nbsp;s, TQt::DateFormat&nbsp;f = TQt::TextDate )</li>
<li class=fn>bool <a href="#isValid-2"><b>isValid</b></a> ( int&nbsp;h, int&nbsp;m, int&nbsp;s, int&nbsp;ms = 0 )</li>
</ul>
<h2>Related Functions</h2>
<ul>
<li class=fn>TQDataStream &amp; <a href="#operator-lt-lt"><b>operator&lt;&lt;</b></a> ( TQDataStream&nbsp;&amp;&nbsp;s, const&nbsp;TQTime&nbsp;&amp;&nbsp;t )</li>
<li class=fn>TQDataStream &amp; <a href="#operator-gt-gt"><b>operator&gt;&gt;</b></a> ( TQDataStream&nbsp;&amp;&nbsp;s, TQTime&nbsp;&amp;&nbsp;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="tqdate.html">TQDate</a>, <a href="tqdatetime.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&nbsp;h, int&nbsp;m, int&nbsp;s = 0, int&nbsp;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="tqtime.html">TQTime</a> <a name="addMSecs"></a>TQTime::addMSecs ( int&nbsp;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="tqtime.html">TQTime</a> <a name="addSecs"></a>TQTime::addSecs ( int&nbsp;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="tqdatetime.html#addSecs">TQDateTime::addSecs</a>().

<h3 class=fn><a href="tqtime.html">TQTime</a> <a name="currentTime"></a>TQTime::currentTime ( <a href="tqt.html#TimeSpec-enum">TQt::TimeSpec</a>&nbsp;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="tqt.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="tqtime.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="tqtime.html">TQTime</a> <a name="fromString"></a>TQTime::fromString ( const&nbsp;<a href="tqstring.html">TQString</a>&nbsp;&amp;&nbsp;s, <a href="tqt.html#DateFormat-enum">TQt::DateFormat</a>&nbsp;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="tqt.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&nbsp;h, int&nbsp;m, int&nbsp;s, int&nbsp;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&nbsp;<a href="tqtime.html">TQTime</a>&nbsp;&amp;&nbsp;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&nbsp;<a href="tqtime.html">TQTime</a>&nbsp;&amp;&nbsp;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&lt; ( const&nbsp;<a href="tqtime.html">TQTime</a>&nbsp;&amp;&nbsp;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&lt;= ( const&nbsp;<a href="tqtime.html">TQTime</a>&nbsp;&amp;&nbsp;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&nbsp;<a href="tqtime.html">TQTime</a>&nbsp;&amp;&nbsp;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&gt; ( const&nbsp;<a href="tqtime.html">TQTime</a>&nbsp;&amp;&nbsp;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&gt;= ( const&nbsp;<a href="tqtime.html">TQTime</a>&nbsp;&amp;&nbsp;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&nbsp;<a href="tqtime.html">TQTime</a>&nbsp;&amp;&nbsp;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="tqdatetime.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&nbsp;h, int&nbsp;m, int&nbsp;s, int&nbsp;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="tqapplication.html#qDebug">tqDebug</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="tqstring.html">TQString</a> <a name="toString"></a>TQTime::toString ( const&nbsp;<a href="tqstring.html">TQString</a>&nbsp;&amp;&nbsp;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="tqstring.html#TQString-null">TQString::null</a> will be returned.
<p> <p>See also <a href="tqdate.html#toString">TQDate::toString</a>() and <a href="tqdatetime.html#toString">TQDateTime::toString</a>().

<h3 class=fn><a href="tqstring.html">TQString</a> <a name="toString-2"></a>TQTime::toString ( <a href="tqt.html#DateFormat-enum">TQt::DateFormat</a>&nbsp;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="tqt.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="tqt.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="tqstring.html#TQString-null">TQString::null</a> will be returned.

<hr><h2>Related Functions</h2>
<h3 class=fn><a href="tqdatastream.html">TQDataStream</a>&nbsp;&amp; <a name="operator-lt-lt"></a>operator&lt;&lt; ( <a href="tqdatastream.html">TQDataStream</a>&nbsp;&amp;&nbsp;s, const&nbsp;<a href="tqtime.html">TQTime</a>&nbsp;&amp;&nbsp;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="tqdatastream.html">TQDataStream</a>&nbsp;&amp; <a name="operator-gt-gt"></a>operator&gt;&gt; ( <a href="tqdatastream.html">TQDataStream</a>&nbsp;&amp;&nbsp;s, <a href="tqtime.html">TQTime</a>&nbsp;&amp;&nbsp;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 &copy; 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 &copy; 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>