SbTime(3)
๐ NAME ๐
SbTime โ the class whose instances are time values. Bestie, she's a whole timestamp, a duration, a whole moment, all in one object. โฐโจ
This page lives in the Library Functions Manual, section 3, so you already know she's a library call and not a command you run in your shell. ๐ซถ
โจ SYNOPSIS โจ
Pull her in like this:
#include <Inventor/SbTime.h>
๐ Public Member Functions
SbTime (void)
SbTime (const double sec)
SbTime (const int32_t sec, const long usec)
SbTime (const struct timeval *const tv)
void setToTimeOfDay (void)
void setValue (const double sec)
void setValue (const int32_t sec, const long usec)
void setValue (const struct timeval *const tv)
void setMsecValue (const unsigned long msec)
double getValue (void) const
void getValue (time_t &sec, long &usec) const
void getValue (struct timeval *tv) const
unsigned long getMsecValue (void) const
SbString format (const char *const fmt='%S.%i') const
SbString formatDate (const char *const fmt=NULL) const
SbBool parsedate (const char *const date)
SbTime & operator+= (const SbTime &tm)
SbTime & operator-= (const SbTime &tm)
SbTime operator- (void) const
SbTime & operator*= (const double s)
SbTime & operator/= (const double s)
double operator/ (const SbTime &tm) const
SbTime operator% (const SbTime &tm) const
int operator== (const SbTime &tm) const
int operator!= (const SbTime &tm) const
SbBool operator< (const SbTime &tm) const
SbBool operator> (const SbTime &tm) const
SbBool operator<= (const SbTime &tm) const
SbBool operator>= (const SbTime &tm) const
void print (FILE *fp) const
๐ Static Public Member Functions
static SbTime getTimeOfDay (void)
static SbTime zero (void)
static SbTime max (void)
static SbTime maxTime (void)
static void sleep (int msec)
๐ฆ Detailed Description ๐ฆ
The SbTime class instances represents time values. No cap, that's literally the whole thing. ๐
SbTime is a convenient way of doing system independent representation and calculations on time values of high resolution. So like โ same vibes on every platform, and she does not round you off to the nearest second. Precision queen. ๐ฅ
๐ธ Constructor & Destructor Documentation ๐ธ
๐ผ SbTime::SbTime (void )
The default constructor sets up a time instance of 0 seconds. Starting from zero, main character origin story. ๐ซ
๐ SbTime::SbTime (const double sec)
Construct and initialize an SbTime instance to a time specified as sec seconds.
โจ SbTime::SbTime (const int32_t sec, const long usec)
Construct and initialize an SbTime instance to a date and time of sec number of seconds and usec number of microseconds. Microseconds!! She's detailed. ๐
๐ซถ SbTime::SbTime (const struct timeval *const tv)
Construct and initialize an SbTime instance to the date and time given by the struct timeval. Wanna know what's inside a timeval? Bestie, go consult your system developer documentation, that's a them problem. ๐
๐ Member Function Documentation ๐
โฐ SbTime SbTime::getTimeOfDay (void ) [static]
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). The epoch!! She's ancient and iconic. ๐ฐ๏ธ
๐ See also: setToTimeOfDay().
๐ฐ๏ธ void SbTime::setToTimeOfDay (void )
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.
๐ See also: getTimeOfDay().
๐ซฅ SbTime SbTime::zero (void ) [static]
Returns an SbTime instance representing zero time. Nothing, nobody, no time at all. ๐
๐ See also: zero().
๐ SbTime SbTime::max (void ) [static]
Returns an SbTime instance representing the maximum representable time/date. The end of time, basically, slay.
โ ๏ธ This method is not available under MSWindows, as max() crashes with a define macro Microsoft has polluted the global namespace with. Not her fault, not your fault, it's the macro's fault. ๐
๐ See also: zero().
๐ SbTime SbTime::maxTime (void ) [static]
Returns an SbTime instance representing the maximum representable time/date. Same energy as max(), but this one survives the Windows macro situation. ๐ซถ
๐ See also: zero().
๐ด void SbTime::sleep (int msec) [static]
Suspends the current thread for msec milliseconds. Thread said "brb, napping". ๐ค
๐ See also: cc_sleep().
๐ Since Coin 3.0
โ๏ธ void SbTime::setValue (const double sec)
Reset an SbTime instance to sec number of seconds.
๐ See also: getValue().
โ๏ธ void SbTime::setValue (const int32_t sec, const long usec)
Reset an SbTime instance to sec number of seconds and usec number of microseconds.
๐ See also: getValue().
โ๏ธ void SbTime::setValue (const struct timeval *const tv)
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. (Again. Yes, again. ๐)
๐ See also: getValue().
โ๏ธ void SbTime::setMsecValue (const unsigned long msec)
Set the time by msec number of milliseconds.
๐ See also: getMsecValue().
๐ double SbTime::getValue (void ) const
Return time as number of seconds.
๐ See also: setValue().
๐ void SbTime::getValue (time_t & sec, long & usec) const
Return number of seconds and microseconds which the SbTime instance represents.
๐ See also: setValue().
๐ void SbTime::getValue (struct timeval * tv) const
Returns the time as a timeval structure. For information on the timeval structure, please consult your system developer documentation. You know the drill by now. ๐
๐ See also: setValue().
โ ๏ธ unsigned long SbTime::getMsecValue (void ) const
Return number of milliseconds which the SbTime instance represents.
๐จ Important note, listen up bestie: 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 anunsigned longwraps around in a fairly short time when used for counting milliseconds: in less than 50 days. (And sinceSbTimeinstances are often initialized to be the time since the start of the epoch (ie1970-01-01 00:00), the value will have wrapped around many, many times.) It's giving ticking time bomb. ๐
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.
๐ See also: setMsecValue()
๐ SbString SbTime::format (const char *const fmt = '%S.%i') 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 fmt will be copied directly to the resultant SbString. So like, she'll pass your lil decorative text straight through untouched. โจ
%% - 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. So don't come for her when your clock looks off, she told you upfront. ๐ฐ๏ธ
๐ See also: formatDate().
๐ SbString SbTime::formatDate (const char *const fmt = NULL) 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.
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). She adapts. Versatile queen. ๐
๐ See also: format().
๐ SbBool SbTime::parsedate (const char *const date)
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. Garbage in, FALSE out, that's the deal. ๐
โโ๏ธ
โ SbTime & SbTime::operator+= (const SbTime & tm)
Add tm to time value and return reference to self.
โ SbTime & SbTime::operator-= (const SbTime & tm)
Subtract tm from time value and return reference to self.
๐ SbTime SbTime::operator- (void ) const
Return the negated time. Negative time, the girl goes backwards. ๐ฆ
โ๏ธ SbTime & operator*= (const double s)
Multiply time value with s and return reference to self.
โ SbTime & operator/= (const double s)
Divide time value with s and return reference to self.
๐งฎ double operator/ (const SbTime & tm) const
Find the factor between this SbTime and the one given in tm, and return the result.
๐ฉ SbTime SbTime::operator% (const SbTime & tm) const
Returns the remainder time when dividing on tm.
๐ฐ int SbTime::operator== (const SbTime & tm) const
Check if the time value is equal to that of tm.
๐ซ int SbTime::operator!= (const SbTime & tm) const
Check if the time value is not equal to that of tm.
๐ฝ SbBool SbTime::operator< (const SbTime & tm) const
Compares with tm and return TRUE if less.
๐ผ SbBool SbTime::operator> (const SbTime & tm) const
Compares with tm and return TRUE if larger than.
โฌ SbBool SbTime::operator<= (const SbTime & tm) const
Compares with tm and return TRUE if less or equal.
โซ SbBool SbTime::operator>= (const SbTime & tm) const
Compares with tm and return TRUE if larger or equal.
๐จ๏ธ void SbTime::print (FILE * fp) const
Dump the state of this object to the file stream. Only works in debug version of library, method does nothing in an optimized compile. So in release builds she's silent, which honestly? Respect. ๐คซ
๐ Author ๐
Generated automatically by Doxygen for Coin from the source code. She didn't write herself, bestie, a robot did it. ๐ค๐
okay that's the whole page ๐ this is Coin, Version 3.1.3, and you just read SbTime(3). Go forth and timestamp responsibly. ๐
โจ๐ฆ
๐ฆ where this page comes from
- fedora 43: Coin3-devel 3.1.3-40.fc43 ยท GPL-2.0-only
- fedora 43: Coin3-devel 3.1.3-40.fc43 ยท GPL-2.0-only
- fedora 44: Coin3-devel 3.1.3-42.fc44 ยท GPL-2.0-only
- fedora 44: Coin3-devel 3.1.3-42.fc44 ยท GPL-2.0-only
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms