logo
Free, unlimited AI code reviews that run on commit
git-lrc git-lrc GitHub Install Now We'd appreciate a star git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt

SbTime — class for representation of a time

Description

       This  class  represents  and  performs operations on time. Operations may be done in seconds, seconds and
       microseconds, or using a structtimeval (defined in /usr/include/sys/time.h).

Inherits From

       SbTime

Methods

SbTime()SbTime(doublesec)SbTime(int32_tsec,longusec)SbTime(conststructtimeval*tv)
          Constructors taking seconds, seconds and microseconds, or a structtimeval.   NOTE  that  an  integer
          parameter  will  not automatically cast to a double to invoke the constructor taking seconds; that is,
          SbTime(1) will result in a compilation error. SbTime(1.0) must be  used  instead.  This  is  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.

     staticSbTimegetTimeOfDay()
          Get the current time (seconds since Jan 1, 1970).

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

     staticSbTimezero()
          Get a zero time.

     staticSbTimemax()
          Get a time far, far into the future.

     voidsetValue(doublesec)
          Set time from a double (in seconds).

     voidsetValue(int32_tsec,longusec)
          Set time from seconds + microseconds.

     voidsetValue(conststructtimeval*tv)
          Set time from a structtimeval.

     voidsetMsecValue(unsignedlongmsec)
          Set time from milliseconds.

     doublegetValue()const
          Get time in seconds as a double.

     voidgetValue(int32_t&sec,long&usec)const
          Get time in seconds and microseconds.

     voidgetValue(structtimeval*tv)const
          Get time in a structtimeval.

     unsignedlonggetMsecValue()const
          Get time in milliseconds (for Xt).

     SbStringformat(constchar*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.

     SbStringformatDate(constchar*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.

     SbTimeoperator+(constSbTime&t0,constSbTime&t1)SbTimeoperator-(constSbTime&t0,constSbTime&t1)
          Addition and subtraction of two times.

     SbTime&operator+=(constSbTime&tm)SbTime&operator-=(constSbTime&tm)
          Addition and subtraction of two times which modifies the time structure.

     SbTimeoperator-()const
          Unary negation.

     SbTimeoperator*(doubles,constSbTime&tm)SbTimeoperator*(constSbTime&tm,doubles)SbTimeoperator/(constSbTime&tm,doubles)
          Multiplication and division by scalar.

     SbTime&operator*=(doubles)SbTime&operator/=(doubles)
          Destructive multiplication and division by scalar.

     doubleoperator/(constSbTime&tm)const
          Division by another time.

     SbTimeoperator%(constSbTime&tm)const
          Modulus for two times (remainder when time1 is divided by time2).

     intoperator==(constSbTime&tm)constintoperator!=(constSbTime&tm)const
          Equality operators.

     SbBooloperator<(constSbTime&tm)constSbBooloperator>(constSbTime&tm)constSbBooloperator<=(constSbTime&tm)constSbBooloperator>=(constSbTime&tm)const
          Relational operators.

Name

       SbTime — class for representation of a time

See Also

cftimeSbTime(3IV)()

Synopsis

#include<Inventor/SbTime.h>

          Methods from class SbTime:

                         SbTime()SbTime(doublesec)SbTime(int32_tsec,longusec)SbTime(conststructtimeval*tv)staticSbTimegetTimeOfDay()voidsetToTimeOfDay()staticSbTimezero()staticSbTimemax()voidsetValue(doublesec)voidsetValue(int32_tsec,longusec)voidsetValue(conststructtimeval*tv)voidsetMsecValue(unsignedlongmsec)doublegetValue()constvoidgetValue(int32_t&sec,long&usec)constvoidgetValue(structtimeval*tv)constunsignedlonggetMsecValue()constSbStringformat(constchar*fmt="%S.%i")constSbStringformatDate(constchar*fmt="%A,%D%r")constSbTimeoperator+(constSbTime&t0,constSbTime&t1)SbTimeoperator-(constSbTime&t0,constSbTime&t1)SbTime&operator+=(constSbTime&tm)SbTime&operator-=(constSbTime&tm)SbTimeoperator-()constSbTimeoperator*(doubles,constSbTime&tm)SbTimeoperator*(constSbTime&tm,doubles)SbTimeoperator/(constSbTime&tm,doubles)SbTime&operator*=(doubles)SbTime&operator/=(doubles)doubleoperator/(constSbTime&tm)constSbTimeoperator%(constSbTime&tm)constintoperator==(constSbTime&tm)constintoperator!=(constSbTime&tm)constSbBooloperator<(constSbTime&tm)constSbBooloperator>(constSbTime&tm)constSbBooloperator<=(constSbTime&tm)constSbBooloperator>=(constSbTime&tm)const

See Also