SBTIME(3iv)

๐Ÿ’– SbTime โ€” class for representation of a time ๐Ÿ’–

okay bestie, pull up a chair, we're doing SbTime from the 3IV section of the manual, and it's genuinely iconic. no cap.


๐ŸŒธ NAME ๐ŸŒธ

SbTime โ€” class for representation of a time โฐโœจ


๐Ÿซถ INHERITS FROM ๐Ÿซถ

SbTime โ€” yeah she inherits from herself, main character energy fr fr ๐Ÿ’…


โœจ SYNOPSIS โœจ

#include <Inventor/SbTime.h>

Methods from class SbTime:

                     SbTime()
                     SbTime(double sec)
                     SbTime(int32_t sec, long usec)
                     SbTime(const struct timeval *tv)
 static SbTime       getTimeOfDay()
 void                setToTimeOfDay()
 static SbTime       zero()
 static SbTime       max()
 void                setValue(double sec)
 void                setValue(int32_t sec, long usec)
 void                setValue(const struct timeval *tv)
 void                setMsecValue(unsigned long msec)
 double              getValue() const
 void                getValue(int32_t &sec, long &usec) const
 void                getValue(struct timeval *tv) const
 unsigned long       getMsecValue() const
 SbString            format(const char *fmt = "%S.%i") const
 SbString            formatDate(const char *fmt = "%A, %D %r") const
 SbTime              operator +(const SbTime &t0, const SbTime &t1)
 SbTime              operator -(const SbTime &t0, const SbTime &t1)
 SbTime &            operator +=(const SbTime &tm)
 SbTime &            operator -=(const SbTime &tm)
 SbTime              operator -() const
 SbTime              operator *(double s, const SbTime &tm)
 SbTime              operator *(const SbTime &tm, double s)
 SbTime              operator /(const SbTime &tm, double s)
 SbTime &            operator *=(double s)
 SbTime &            operator /=(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

๐Ÿ’œ DESCRIPTION ๐Ÿ’œ

so basically, this class represents time and does whole operations on it. and the way that you can work in seconds, or seconds and microseconds, or with a struct timeval (which is defined over in /usr/include/sys/time.h)?? versatile queen ๐Ÿ‘‘โœจ


๐ŸŽ€ METHODS ๐ŸŽ€

๐Ÿฆ‹ the constructors

SbTime()
SbTime(double sec)
SbTime(int32_t sec, long usec)
SbTime(const struct timeval *tv)

constructors that take seconds, or seconds and microseconds, or a struct timeval, pick your fighter ๐Ÿ’…

NOTE, and this part MATTERS: an integer parameter will not automatically cast to a double to invoke the constructor taking seconds. like, SbTime(1) will result in a compilation error ๐Ÿ˜ญ you have to write SbTime(1.0) instead. this is deliberately to avoid errors in upgrading from an earlier release, in which SbTime(1) had different semantics. in future releases this distinction will be eliminated, and the effect of SbTime(1.0) and that of SbTime(1) will be identical. iykyk.

๐Ÿ•ฐ๏ธ static SbTime getTimeOfDay()

get the current time (seconds since Jan 1, 1970). she knows what time it is, always ๐Ÿซถ

๐ŸŒž void setToTimeOfDay()

set to the current time (seconds since Jan 1, 1970).

0๏ธโƒฃ static SbTime zero()

get a zero time. nothing, nada, the void, but make it a class ๐Ÿ’€

๐Ÿš€ static SbTime max()

get a time far, far into the future. like, unreasonably far. princess treatment timeline โœจ

๐Ÿ“ void setValue(double sec)

set time from a double (in seconds).

๐Ÿ“ void setValue(int32_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(int32_t &sec, long &usec) const

get time in seconds and microseconds.

๐Ÿ” void getValue(struct timeval *tv) const

get time in a struct timeval.

๐Ÿงฎ unsigned long getMsecValue() const

get time in milliseconds (for Xt). ok Xt representation we see you ๐Ÿ‘€

๐ŸŽจ SbString format(const char *fmt = "%S.%i") const

convert to a string. 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 โ€” for negative times; the lowercase descriptors are formatted fixed width, with leading zeros. for example, a reasonable format string might be "elapsed time: %M minutes, %s seconds". the default value of fmt, "%S.%i", formats the time as seconds with 3 digits of fractional precision. cute, precise, obsessed ๐ŸŽ€

๐Ÿ“… SbString formatDate(const char *fmt = "%A, %D %r") const

convert to a date string, interpreting the time as seconds since Jan 1, 1970. the default format gives "Tuesday, 01/26/93 11:23:41 AM". see the cftime() reference page for explanation of the format string. calendar girlie behavior ๐Ÿ—“๏ธ๐Ÿ’–

โž•โž– SbTime operator +(const SbTime &t0, const SbTime &t1) and SbTime operator -(const SbTime &t0, const SbTime &t1)

SbTime operator +(const SbTime &t0, const SbTime &t1)
SbTime operator -(const SbTime &t0, const SbTime &t1)

addition and subtraction of two times.

๐Ÿ” SbTime & operator +=(const SbTime &tm) and SbTime & operator -=(const SbTime &tm)

SbTime & operator +=(const SbTime &tm)
SbTime & operator -=(const SbTime &tm)

addition and subtraction of two times which modifies the time structure. she's not copying, she's changing herself in place, character development ๐Ÿ’…

๐Ÿ™ƒ SbTime operator -() const

unary negation.

โœ–๏ธโž— operator *(double s, const SbTime &tm), operator *(const SbTime &tm, double s), operator /(const SbTime &tm, double s)

SbTime operator *(double s, const SbTime &tm)
SbTime operator *(const SbTime &tm, double s)
SbTime operator /(const SbTime &tm, double s)

multiplication and division by scalar.

๐Ÿ’ฅ SbTime & operator *=(double s) and SbTime & operator /=(double s)

SbTime & operator *=(double s)
SbTime & operator /=(double s)

destructive multiplication and division by scalar. yes bestie, destructive, she goes in and rearranges her own furniture ๐Ÿซฃ

๐Ÿฐ 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).

โš–๏ธ int operator ==(const SbTime &tm) const and int operator !=(const SbTime &tm) const

int operator ==(const SbTime &tm) const
int operator !=(const SbTime &tm) const

equality operators. are y'all the same or not, let's find out ๐ŸŒˆ

๐Ÿ“Š operator <, operator >, operator <=, operator >=

SbBool operator <(const SbTime &tm) const
SbBool operator >(const SbTime &tm) const
SbBool operator <=(const SbTime &tm) const
SbBool operator >=(const SbTime &tm) const

relational operators. comparing eras, lowkey ๐ŸŒธ


๐Ÿ‘€ SEE ALSO ๐Ÿ‘€

cftime


okay that's the whole thing, bestie, you're officially fluent in SbTime ๐Ÿ’– this was the SbTime(3IV) page, section 3IV, and honestly? she ate. no date on this one, just pure timeless class energy โฐโœจ๐Ÿ’… bye pookie ๐Ÿซถ