.TH "SbTime" 3 "Thu May 29 2014" "Version 4.0.0a" "Coin" \" -*- nroff -*- .ad l .nh .SH NAME SbTime \- .PP The \fBSbTime\fP class instances represents time values\&. .PP \fBSbTime\fP is a convenient way of doing system independent representation and calculations on time values of high resolution\&. .SH SYNOPSIS .br .PP .PP \fC#include \fP .SS "Public Member Functions" .in +1c .ti -1c .RI "\fBSbTime\fP (void)" .br .ti -1c .RI "\fBSbTime\fP (const double sec)" .br .ti -1c .RI "\fBSbTime\fP (const int32_t sec, const long usec)" .br .ti -1c .RI "\fBSbTime\fP (const struct timeval *const tv)" .br .ti -1c .RI "void \fBsetToTimeOfDay\fP (void)" .br .ti -1c .RI "void \fBsetValue\fP (const double sec)" .br .ti -1c .RI "void \fBsetValue\fP (const int32_t sec, const long usec)" .br .ti -1c .RI "void \fBsetValue\fP (const struct timeval *const tv)" .br .ti -1c .RI "void \fBsetMsecValue\fP (const unsigned long msec)" .br .ti -1c .RI "double \fBgetValue\fP (void) const " .br .ti -1c .RI "void \fBgetValue\fP (time_t &sec, long &usec) const " .br .ti -1c .RI "void \fBgetValue\fP (struct timeval *tv) const " .br .ti -1c .RI "unsigned long \fBgetMsecValue\fP (void) const " .br .ti -1c .RI "\fBSbString\fP \fBformat\fP (const char *const fmt='%S\&.%i') const " .br .ti -1c .RI "\fBSbString\fP \fBformatDate\fP (const char *const fmt=NULL) const " .br .ti -1c .RI "SbBool \fBparsedate\fP (const char *const date)" .br .ti -1c .RI "\fBSbTime\fP & \fBoperator+=\fP (const \fBSbTime\fP &tm)" .br .ti -1c .RI "\fBSbTime\fP & \fBoperator-=\fP (const \fBSbTime\fP &tm)" .br .ti -1c .RI "\fBSbTime\fP \fBoperator-\fP (void) const " .br .ti -1c .RI "\fBSbTime\fP & \fBoperator*=\fP (const double s)" .br .ti -1c .RI "\fBSbTime\fP & \fBoperator/=\fP (const double s)" .br .ti -1c .RI "double \fBoperator/\fP (const \fBSbTime\fP &tm) const " .br .ti -1c .RI "\fBSbTime\fP \fBoperator%\fP (const \fBSbTime\fP &tm) const " .br .ti -1c .RI "int \fBoperator==\fP (const \fBSbTime\fP &tm) const " .br .ti -1c .RI "int \fBoperator!=\fP (const \fBSbTime\fP &tm) const " .br .ti -1c .RI "SbBool \fBoperator<\fP (const \fBSbTime\fP &tm) const " .br .ti -1c .RI "SbBool \fBoperator>\fP (const \fBSbTime\fP &tm) const " .br .ti -1c .RI "SbBool \fBoperator<=\fP (const \fBSbTime\fP &tm) const " .br .ti -1c .RI "SbBool \fBoperator>=\fP (const \fBSbTime\fP &tm) const " .br .ti -1c .RI "void \fBprint\fP (FILE *fp) const " .br .in -1c .SS "Static Public Member Functions" .in +1c .ti -1c .RI "static \fBSbTime\fP \fBgetTimeOfDay\fP (void)" .br .ti -1c .RI "static \fBSbTime\fP \fBzero\fP (void)" .br .ti -1c .RI "static \fBSbTime\fP \fBmax\fP (void)" .br .ti -1c .RI "static \fBSbTime\fP \fBmaxTime\fP (void)" .br .ti -1c .RI "static void \fBsleep\fP (int msec)" .br .in -1c .SS "Friends" .in +1c .ti -1c .RI "\fBSbTime\fP \fBoperator+\fP (const \fBSbTime\fP &t0, const \fBSbTime\fP &t1)" .br .ti -1c .RI "\fBSbTime\fP \fBoperator-\fP (const \fBSbTime\fP &t0, const \fBSbTime\fP &t1)" .br .ti -1c .RI "\fBSbTime\fP \fBoperator*\fP (const double s, const \fBSbTime\fP &tm)" .br .ti -1c .RI "\fBSbTime\fP \fBoperator*\fP (const \fBSbTime\fP &tm, const double s)" .br .ti -1c .RI "\fBSbTime\fP \fBoperator/\fP (const \fBSbTime\fP &tm, const double s)" .br .in -1c .SH "Detailed Description" .PP The \fBSbTime\fP class instances represents time values\&. .PP \fBSbTime\fP is a convenient way of doing system independent representation and calculations on time values of high resolution\&. .SH "Constructor & Destructor Documentation" .PP .SS "SbTime::SbTime (void)" The default constructor sets up a time instance of 0 seconds\&. .SS "SbTime::SbTime (const doublesec)" Construct and initialize an \fBSbTime\fP instance to a time specified as \fIsec\fP seconds\&. .SS "SbTime::SbTime (const int32_tsec, const longusec)" Construct and initialize an \fBSbTime\fP instance to a date and time \fIsec\fP number of seconds and \fIusec\fP number of microseconds\&. .SS "SbTime::SbTime (const struct timeval *consttv)" Construct and initialize an \fBSbTime\fP instance to the date and time given by the \fIstruct\fP \fItimeval\fP\&. For information on the \fItimeval\fP structure, please consult your system developer documentation\&. .SH "Member Function Documentation" .PP .SS "\fBSbTime\fP SbTime::getTimeOfDay (void)\fC [static]\fP" Returns an \fBSbTime\fP 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)\&. .PP \fBSee also:\fP .RS 4 \fBsetToTimeOfDay()\fP\&. .RE .PP .SS "void SbTime::setToTimeOfDay (void)" Set this \fBSbTime\fP 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\&. .PP \fBSee also:\fP .RS 4 \fBgetTimeOfDay()\fP\&. .RE .PP .SS "\fBSbTime\fP SbTime::zero (void)\fC [static]\fP" Returns an \fBSbTime\fP instance representing zero time\&. .PP \fBSee also:\fP .RS 4 \fBzero()\fP\&. .RE .PP .SS "\fBSbTime\fP SbTime::max (void)\fC [static]\fP" Returns an \fBSbTime\fP instance representing the maximum representable time/date\&. .PP This method is not available under MSWindows, as \fBmax()\fP crashes with a define macro Microsoft has polluted the global namespace with\&. .PP \fBSee also:\fP .RS 4 \fBzero()\fP\&. .RE .PP .SS "\fBSbTime\fP SbTime::maxTime (void)\fC [static]\fP" Returns an \fBSbTime\fP instance representing the maximum representable time/date\&. .PP \fBSee also:\fP .RS 4 \fBzero()\fP\&. .RE .PP .SS "void SbTime::sleep (intmsec)\fC [static]\fP" Suspends the current thread for \fImsec\fP milliseconds\&. .PP \fBSee also:\fP .RS 4 cc_sleep()\&. .RE .PP \fBSince:\fP .RS 4 Coin 3\&.0 .RE .PP .SS "void SbTime::setValue (const doublesec)" Reset an \fBSbTime\fP instance to \fIsec\fP number of seconds\&. .PP \fBSee also:\fP .RS 4 \fBgetValue()\fP\&. .RE .PP .SS "void SbTime::setValue (const int32_tsec, const longusec)" Reset an \fBSbTime\fP instance to \fIsec\fP number of seconds and \fIusec\fP number of microseconds\&. .PP \fBSee also:\fP .RS 4 \fBgetValue()\fP\&. .RE .PP .SS "void SbTime::setValue (const struct timeval *consttv)" Reset an \fBSbTime\fP instance to the date and time given by the \fItimeval\fP struct\&. For information on the \fItimeval\fP struct, please consult your developer system documentation\&. .PP \fBSee also:\fP .RS 4 \fBgetValue()\fP\&. .RE .PP .SS "void SbTime::setMsecValue (const unsigned longmsec)" Set the time by \fImsec\fP number of milliseconds\&. .PP \fBSee also:\fP .RS 4 \fBgetMsecValue()\fP\&. .RE .PP .SS "double SbTime::getValue (void) const" Return time as number of seconds\&. .PP \fBSee also:\fP .RS 4 \fBsetValue()\fP\&. .RE .PP .SS "void SbTime::getValue (time_t &sec, long &usec) const" Return number of seconds and microseconds which the \fBSbTime\fP instance represents\&. .PP \fBSee also:\fP .RS 4 \fBsetValue()\fP\&. .RE .PP .SS "void SbTime::getValue (struct timeval *tv) const" Returns the time as a \fItimeval\fP structure\&. For information on the \fItimeval\fP structure, please consult your system developer documentation\&. .PP \fBSee also:\fP .RS 4 \fBsetValue()\fP\&. .RE .PP .SS "unsigned long SbTime::getMsecValue (void) const" Return number of milliseconds which the \fBSbTime\fP instance represents\&. .PP 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 \fBSbTime\fP instances are often initialized to be the time since the start of the epoch (ie 1970-01-01 00:00), the value will have wrapped around many, many times\&.) .PP You are probably better off using the \fBgetValue()\fP 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 \fBSbTime\fP instance\&. .PP \fBSee also:\fP .RS 4 \fBsetMsecValue()\fP .RE .PP .SS "\fBSbString\fP SbTime::format (const char *constfmt = \fC'%S\&.%i'\fP) const" 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 \fIfmt\fP will be copied directly to the resultant \fBSbString\fP\&. .PP %% - insert a single ''\&. .br D - number of days\&. .br H - number of hours\&. .br h - remaining hours after subtracting number of days\&. .br M - number of minutes\&. .br m - remaining minutes after subtracting the total number of hours\&. .br S - number of seconds\&. .br s - remaining seconds after subtracting the total number of minutes\&. .br I - number of milliseconds\&. .br i - remaining milliseconds after subtracting the total number of seconds\&. .br U - number of microseconds\&. .br u - remaining microseconds after subtracting the total number of mseconds\&. .br .PP The result shows UTC time, not corrected for local time zone nor daylight savings time\&. .PP \fBSee also:\fP .RS 4 \fBformatDate()\fP\&. .RE .PP .SS "\fBSbString\fP SbTime::formatDate (const char *constfmt = \fCNULL\fP) const" 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\&. .PP Default formatting is used if \fIfmt\fP is \fCNULL\fP\&. Note that the default formatting is different on Microsoft Windows systems versus all other systems\&. For Windows, it is \fC'%#c'\fP, for other systems it is \fC'%A, %D %r'\fP (again, see system documentation on strftime() for more information)\&. .PP The value of \fBSbTime\fP will be interpreted as seconds since 00:00:00 1970-01-01\&. .PP The result shows local time, according to local time zone and daylight savings time (if and when applicable)\&. .PP \fBSee also:\fP .RS 4 \fBformat()\fP\&. .RE .PP .SS "SbBool SbTime::parsedate (const char *constdate)" This method takes a date string and converts it to the internal \fBSbTime\fP 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)\&. .PP Feeding an invalid date string to this method will make it return \fIFALSE\fP\&. .SS "\fBSbTime\fP & SbTime::operator+= (const \fBSbTime\fP &tm)" Add \fItm\fP to time value and return reference to self\&. .SS "\fBSbTime\fP & SbTime::operator-= (const \fBSbTime\fP &tm)" Subtract \fItm\fP from time value and return reference to self\&. .SS "\fBSbTime\fP SbTime::operator- (void) const" Return the negated time\&. .SS "\fBSbTime\fP & operator*= (const doubles)" Multiply time value with \fIs\fP and return reference to self\&. .SS "\fBSbTime\fP & operator/= (const doubles)" Divide time value with \fIs\fP and return reference to self\&. .SS "double operator/ (const \fBSbTime\fP &tm) const" Find the factor between this \fBSbTime\fP and the one given in \fItm\fP, and return the result\&. .SS "\fBSbTime\fP SbTime::operator% (const \fBSbTime\fP &tm) const" Returns the remainder time when dividing on \fItm\fP\&. .SS "int SbTime::operator== (const \fBSbTime\fP &tm) const" Check if the time value is equal to that of \fItm\fP\&. .SS "int SbTime::operator!= (const \fBSbTime\fP &tm) const" Check if the time value is not equal to that of \fItm\fP\&. .SS "SbBool SbTime::operator< (const \fBSbTime\fP &tm) const" Compares with \fItm\fP and return TRUE if less\&. .SS "SbBool SbTime::operator> (const \fBSbTime\fP &tm) const" Compares with \fItm\fP and return TRUE if larger than\&. .SS "SbBool SbTime::operator<= (const \fBSbTime\fP &tm) const" Compares with \fItm\fP and return TRUE if less or equal\&. .SS "SbBool SbTime::operator>= (const \fBSbTime\fP &tm) const" Compares with \fItm\fP and return TRUE if larger or equal\&. .SS "void SbTime::print (FILE *fp) const" Dump the state of this object to the \fIfile\fP stream\&. Only works in debug version of library, method does nothing in an optimized compile\&. .SH "Friends And Related Function Documentation" .PP .SS "\fBSbTime\fP operator+ (const \fBSbTime\fP &t0, const \fBSbTime\fP &t1)\fC [friend]\fP" Add the two SbTimes and return the result\&. .SS "\fBSbTime\fP operator- (const \fBSbTime\fP &t0, const \fBSbTime\fP &t1)\fC [friend]\fP" Subtract \fIt1\fP from \fIt0\fP and return the result\&. .SS "\fBSbTime\fP operator* (const doubles, const \fBSbTime\fP &tm)\fC [friend]\fP" Multiply time value \fItm\fP with \fIs\fP and return result\&. .SS "\fBSbTime\fP operator* (const \fBSbTime\fP &tm, const doubles)\fC [friend]\fP" Multiply time value \fItm\fP with \fIs\fP and return result\&. .SS "\fBSbTime\fP operator/ (const \fBSbTime\fP &tm, const doubles)\fC [friend]\fP" Divide time value \fItm\fP with \fIs\fP and return result\&. .SH "Author" .PP Generated automatically by Doxygen for Coin from the source code\&.