Coin
4.0.3
Coin3D core library
|
The SbTime class instances represents time values. More...
#include <Inventor/SbTime.h>
Static Public Member Functions | |
static SbTime | getTimeOfDay (void) |
static SbTime | max (void) |
static SbTime | maxTime (void) |
static void | sleep (int msec) |
static SbTime | zero (void) |
Related Symbols | |
(Note that these are not member symbols.) | |
SbTime | operator* (const double s, const SbTime &tm) |
SbTime | operator* (const SbTime &tm, const double s) |
SbTime & | operator*= (const double s) |
SbTime | operator+ (const SbTime &t0, const SbTime &t1) |
SbTime | operator- (const SbTime &t0, const SbTime &t1) |
double | operator/ (const SbTime &tm) const |
SbTime | operator/ (const SbTime &tm, const double s) |
SbTime & | operator/= (const double s) |
The SbTime class instances represents time values.
SbTime is a convenient way of doing system independent representation and calculations on time values of high resolution.
SbTime::SbTime | ( | void | ) |
The default constructor sets up a time instance of 0 seconds.
SbTime::SbTime | ( | const double | sec | ) |
Construct and initialize an SbTime instance to a time specified as sec seconds.
Construct and initialize an SbTime instance to a date and time sec number of seconds and usec number of microseconds.
Construct and initialize an SbTime instance to the date and time given by the struct timeval. For information on the timeval structure, please consult your system developer documentation.
Uses the formatting specified below to return a string representation of the stored date/time. Any format specifiers must be prefixed with a '' symbol, any other text in the format string fmt will be copied directly to the resultant SbString.
%% - insert a single ''.
D - number of days.
H - number of hours.
h - remaining hours after subtracting number of days.
M - number of minutes.
m - remaining minutes after subtracting the total number of hours.
S - number of seconds.
s - remaining seconds after subtracting the total number of minutes.
I - number of milliseconds.
i - remaining milliseconds after subtracting the total number of seconds.
U - number of microseconds.
u - remaining microseconds after subtracting the total number of mseconds.
The result shows UTC time, not corrected for local time zone nor daylight savings time.
Accepts the formatting identifiers specified by the POSIX strftime() function to return a string representation of the stored date. Check your reference documentation for strftime() for information on the format modifiers available.
Default formatting is used if fmt is NULL
. Note that the default formatting is different on Microsoft Windows systems versus all other systems. For Windows, it is "%#c"
, for other systems it is "%A, %D %r"
(again, see system documentation on strftime() for more information).
The value of SbTime will be interpreted as seconds since 00:00:00 1970-01-01.
The result shows local time, according to local time zone and daylight savings time (if and when applicable).
Return number of milliseconds which the SbTime instance represents.
Important note: you should in general avoid using this function, as it has an inherent API design flaw (from the original SGI Open Inventor design). The problem is that an unsigned long wraps around in a fairly short time when used for counting milliseconds: in less than 50 days. (And since SbTime instances are often initialized to be the time since the start of the epoch (i.e. 1970-01-01 00:00), the value will have wrapped around many, many times.)
You are probably better off using the getValue() method which returns a double for the number of seconds, then multiply by 1000.0 if you need to know the current number of milliseconds of the SbTime instance.
Returns an SbTime instance with the current clock time. The current time will be given as a particular number of seconds and microseconds since 00:00:00 January 1, 1970, in Coordinated Universal Time (UTC).
Returns the time as a timeval structure. For information on the timeval structure, please consult your system developer documentation.
Return number of seconds and microseconds which the SbTime instance represents.
double SbTime::getValue | ( | void | ) | const |
Return time as number of seconds.
Check if the time value is not equal to that of tm.
Subtract tm from time value and return reference to self.
Find the factor between this SbTime and the one given in tm, and return the result.
Compares with tm and return TRUE if less or equal.
Compares with tm and return TRUE if larger than.
Compares with tm and return TRUE if larger or equal.
This method takes a date string and converts it to the internal SbTime format. The date string must conform to one of three formats, namely the RFC 822 / RFC 1123 format (Wkd, DD Mnth YYYY HH:MM:SS GMT), the RFC 850 / RFC 1036 format (Weekday, DD-Mnth-YY HH:MM:SS GMT), or the asctime() format (Wkdy Mnth D HH:MM:SS YYYY).
Feeding an invalid date string to this method will make it return FALSE.
Dump the state of this object to the fp file stream. Only works in debug version of library, method does nothing in an optimized build.
Set the time by msec number of milliseconds.
Set this SbTime to be the current clock time. The current time will be given as a particular number of seconds and microseconds since 00:00:00.00 1st January 1970.
Reset an SbTime instance to sec number of seconds.
Reset an SbTime instance to sec number of seconds and usec number of microseconds.
Reset an SbTime instance to the date and time given by the timeval struct. For information on the timeval struct, please consult your developer system documentation.
|
static |
Multiply time value tm with s and return result.
Multiply time value tm with s and return result.
Multiply time value with s and return reference to self.
Add the two SbTimes and return the result.
Subtract t1 from t0 and return the result.
Find the factor between this SbTime and the one given in tm, and return the result.
Divide time value tm with s and return result.
Divide time value with s and return reference to self.