Open Inventor Reference
|
Class for representation of a time. More...
#include <Inventor/SbTime.h>
Public Member Functions | |
SbTime () | |
Default constructor. More... | |
SbTime (double sec) | |
Constructor taking seconds. More... | |
SbTime (time_t sec, long usec) | |
Constructor taking seconds + microseconds. More... | |
SbTime (const struct timeval *tv) | |
Constructors taking timeval. More... | |
void | setToTimeOfDay () |
Set to the current time (seconds since Jan 1, 1970). More... | |
void | setValue (double sec) |
Set time from a double (in seconds). More... | |
void | setValue (time_t sec, long usec) |
Set time from seconds + microseconds. More... | |
void | setValue (const struct timeval *tv) |
Set time from a struct timeval. More... | |
void | setMsecValue (unsigned long msec) |
Set time from milliseconds. More... | |
double | getValue () const |
Get time in seconds as a double. More... | |
void | getValue (time_t &sec, long &usec) const |
Get time in seconds & microseconds. More... | |
void | getValue (struct timeval *tv) const |
Get time in a struct timeval. More... | |
unsigned long | getMsecValue () const |
Get time in milliseconds (for Xt). More... | |
SbString | format (const char *fmt="%S.%i") const |
Convert to a string. More... | |
SbString | formatDate (const char *fmt="%A, %D %r") const |
Convert to a date string, interpreting the time as seconds since Jan 1, 1970. More... | |
SbTime & | operator+= (const SbTime &tm) |
Addition and subtraction of two times which modifies the time structure. More... | |
SbTime & | operator-= (const SbTime &tm) |
Addition and subtraction of two times which modifies the time structure. More... | |
SbTime | operator- () const |
Unary negation. More... | |
SbTime & | operator*= (double s) |
Destructive multiplication and division by scalar. More... | |
SbTime & | operator/= (double s) |
Destructive multiplication and division by scalar. More... | |
double | operator/ (const SbTime &tm) const |
division by another time More... | |
SbTime | operator% (const SbTime &tm) const |
Modulus for two times (remainder when time1 is divided by time2). More... | |
bool | operator== (const SbTime &tm) const |
Equality operators. More... | |
bool | operator!= (const SbTime &tm) const |
Equality operators. More... | |
bool | operator< (const SbTime &tm) const |
Relational operators. More... | |
bool | operator> (const SbTime &tm) const |
Relational operators. More... | |
bool | operator<= (const SbTime &tm) const |
Relational operators. More... | |
bool | operator>= (const SbTime &tm) const |
Relational operators. More... | |
Static Public Member Functions | |
static SbTime | getTimeOfDay () |
Get the current time (seconds since Jan 1, 1970). More... | |
static SbTime | zero () |
Get a zero time. More... | |
static SbTime | max () |
Get a time far, far into the future. More... | |
Friends | |
INVENTOR_API SbTime | operator+ (const SbTime &t0, const SbTime &t1) |
Addition. More... | |
INVENTOR_API SbTime | operator- (const SbTime &t0, const SbTime &t1) |
Subtraction. More... | |
INVENTOR_API SbTime | operator* (const SbTime &tm, double s) |
multiplication by scalar More... | |
INVENTOR_API SbTime | operator* (double s, const SbTime &tm) |
INVENTOR_API SbTime | operator/ (const SbTime &tm, double s) |
division by scalar More... | |
This class represents and performs operations on time. Operations may be done in seconds, seconds and microseconds, or using a struct timeval
(defined in /usr/include/sys/time.h).
SbTime::SbTime | ( | double | sec | ) |
|
inline |
SbString SbTime::format | ( | const char * | fmt = "%S.%i" | ) | const |
The default format is seconds with 3 digits of fraction precision. fmt
is a character string that consists of field descriptors and text characters, in a manner analogous to cftime (3C) and printf (3S). Each field descriptor consists of a % character followed by another character which specifies the replacement for the field descriptor. All other characters are copied from fmt
into the result. The following field descriptors are supported:
The uppercase descriptors are formatted with a leading ‘em’ for negative times; the lowercase descriptors are formatted fixed width, with leading zeros. For example, a reasonable format string might be "elapsedtime:%Mminutes,%sseconds". The default value of fmt
, "%S.%i", formats the time as seconds with 3 digits of fractional precision.
SbString SbTime::formatDate | ( | const char * | fmt = "%A, %D %r" | ) | const |
The default format gives "Tuesday, 01/26/93 11:23:41 AM". See the cftime() reference page for explanation of the format string.
|
static |
|
inline |
Definition at line 170 of file SbTime.h.
Referenced by operator/().
|
inline |
|
inlinestatic |
|
inline |
Definition at line 254 of file SbTime.h.
References getValue().
|
inline |
|
inline |
|
inline |
|
inline |
void SbTime::setToTimeOfDay | ( | ) |
|
inline |
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |