|
| | SbTime () |
| | Default constructor.
|
| |
| | SbTime (double sec) |
| | Constructor taking seconds.
|
| |
| | SbTime (time_t sec, long usec) |
| | Constructor taking seconds + microseconds.
|
| |
| | SbTime (const struct timeval *tv) |
| | Constructors taking timeval.
|
| |
| void | setToTimeOfDay () |
| | Set to the current time (seconds since Jan 1, 1970).
|
| |
| void | setValue (double sec) |
| | Set time from a double (in seconds).
|
| |
| void | setValue (time_t sec, long usec) |
| | Set time from seconds + microseconds.
|
| |
| void | setValue (const struct timeval *tv) |
| | Set time from a struct timeval.
|
| |
| void | setMsecValue (unsigned long msec) |
| | Set time from milliseconds.
|
| |
| double | getValue () const |
| | Get time in seconds as a double.
|
| |
| void | getValue (time_t &sec, long &usec) const |
| | Get time in seconds & microseconds.
|
| |
| void | getValue (struct timeval *tv) const |
| | Get time in a struct timeval.
|
| |
| unsigned long | getMsecValue () const |
| | Get time in milliseconds (for Xt).
|
| |
| SbString | format (const char *fmt="%S.%i") const |
| | Convert to a string.
|
| |
| SbString | formatDate (const char *fmt="%A, %D %r") const |
| | Convert to a date string, interpreting the time as seconds since Jan 1, 1970.
|
| |
| SbTime & | operator+= (const SbTime &tm) |
| | Addition and subtraction of two times which modifies the time structure.
|
| |
| SbTime & | operator-= (const SbTime &tm) |
| | Addition and subtraction of two times which modifies the time structure.
|
| |
| SbTime | operator- () const |
| | Unary negation.
|
| |
| SbTime & | operator*= (double s) |
| | Destructive multiplication and division by scalar.
|
| |
| SbTime & | operator/= (double s) |
| | Destructive multiplication and division by scalar.
|
| |
| double | operator/ (const SbTime &tm) const |
| | division by another time
|
| |
| SbTime | operator% (const SbTime &tm) const |
| | Modulus for two times (remainder when time1 is divided by time2).
|
| |
| bool | operator== (const SbTime &tm) const |
| | Equality operators.
|
| |
| bool | operator!= (const SbTime &tm) const |
| | Equality operators.
|
| |
| bool | operator< (const SbTime &tm) const |
| | Relational operators.
|
| |
| bool | operator> (const SbTime &tm) const |
| | Relational operators.
|
| |
| bool | operator<= (const SbTime &tm) const |
| | Relational operators.
|
| |
| bool | operator>= (const SbTime &tm) const |
| | Relational operators.
|
| |
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).
- See Also
- cftime
Definition at line 89 of file SbTime.h.
| 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 `%' character
D total number of days
H total number of hours
M total number of minutes
S total number of seconds
I total number of milliseconds
U total number of microseconds
h hours remaining after the days (00-23)
m minutes remaining after the hours (00-59)
s seconds remaining after the minutes (00-59)
i milliseconds remaining after the seconds (000-999)
u microseconds remaining after the seconds (000000-999999)
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.