66 static const Pt::int64_t Seconds = 1000 * Timespan::Milliseconds;
67 static const Pt::int64_t Minutes = 60 * Timespan::Seconds;
68 static const Pt::int64_t Hours = 60 * Timespan::Minutes;
69 static const Pt::int64_t Days = 24 * Timespan::Hours;
87 : _span(Pt::
int64_t(secs)*Seconds + microsecs)
157 {
return int(_span % 1000); }
165 {
return std::numeric_limits<Pt::int64_t>::max() / 1000; }
245 return int(_span/Days);
251 return int((_span/Hours) % 24);
257 return int(_span/Hours);
263 return int((_span/Minutes) % 60);
269 return int(_span/Minutes);
275 return int((_span/Seconds) % 60);
281 return int(_span/Seconds);
287 return int((_span/Milliseconds) % 1000);
293 return _span/Milliseconds;
298 : _span( Pt::
int64_t(microsecs) +
308 : _span(timespan._span)
315 _span = timespan._span;
351 #endif // Pt_Timespan_h
Timespan & operator-=(const Timespan &d)
Assignment by difference operator.
Definition: Timespan.h:236
Timespan(Pt::int64_t microseconds)
Constructs a Timespan.
Definition: Timespan.h:78
bool isNull() const
Returns true if null.
Definition: Timespan.h:338
Represents time spans in microsecond resolution.
Definition: Timespan.h:62
Timespan & operator=(const Timespan ×pan)
Assignment operator.
Definition: Timespan.h:313
int msecs() const
Returns the number of milliseconds (0 to 999).
Definition: Timespan.h:285
Timespan(long secs, long microsecs)
Constructs a Timespan.
Definition: Timespan.h:86
int seconds() const
Returns the number of seconds (0 to 59).
Definition: Timespan.h:273
void setNull()
Sets to null.
Definition: Timespan.h:344
int_type int64_t
Signed 64-bit integer type.
Definition: Types.h:48
int toHours() const
Returns the total number of hours.
Definition: Timespan.h:255
int usecs() const
Returns the fractions of a millisecond in microseconds (0 to 999).
Definition: Timespan.h:156
int minutes() const
Returns the number of minutes (0 to 59).
Definition: Timespan.h:261
Timespan & operator+=(const Timespan &d)
Assignment by sum operator.
Definition: Timespan.h:229
int toMinutes() const
Returns the total number of minutes.
Definition: Timespan.h:267
int days() const
Returns the number of days.
Definition: Timespan.h:243
Timespan & set(int days, int hours, int minutes, int seconds, int microseconds)
Sets the time span.
Definition: Timespan.h:320
int hours() const
Returns the number of hours (0 to 23).
Definition: Timespan.h:249
int toSeconds() const
Returns the total number of seconds.
Definition: Timespan.h:279
~Timespan()
Destructor.
Definition: Timespan.h:97
Pt::int64_t toMSecs() const
Returns the total number of milliseconds.
Definition: Timespan.h:291
Pt::int64_t toUSecs() const
Returns the total number of microseconds.
Definition: Timespan.h:160
Timespan()
Constructs a zero Timespan.
Definition: Timespan.h:73