| 1 |
NAME SbTime "" "" { class for representation of a time } |
| 2 |
INCLUDE SbTime.h |
| 3 |
DESC { |
| 4 |
This class represents and performs operations on time. Operations may be |
| 5 |
done in seconds, seconds and microseconds, or using a |
| 6 |
\kstruct timeval\. |
| 7 |
(defined in \e/usr/include/sys/time.h\.). |
| 8 |
} |
| 9 |
METHOD "" SbTime() {} |
| 10 |
METHOD CreateSec SbTime(double sec) {} |
| 11 |
METHOD CreateSecUSec SbTime(int32_t sec, long usec) {} |
| 12 |
METHOD CreateTimeval SbTime(const struct timeval *tv) { |
| 13 |
Constructors taking seconds, seconds and microseconds, |
| 14 |
or a \astruct timeval\.. |
| 15 |
\+ |
| 16 |
NOTE that an integer parameter will not automatically cast to a double |
| 17 |
to invoke the constructor taking seconds; that is, \cSbTime(1)\. |
| 18 |
will result in a compilation error. \cSbTime(1.0)\. |
| 19 |
must be used instead. This is to avoid errors in upgrading from an |
| 20 |
earlier release, in which \cSbTime(1)\. |
| 21 |
had different semantics. In future releases, this distinction will |
| 22 |
be eliminated, and the effect of \cSbTime(1.0)\. and that of \cSbTime(1)\. |
| 23 |
will be identical. |
| 24 |
\. |
| 25 |
} |
| 26 |
BEGIN C |
| 27 |
METHOD "" void SbTimeDelete(SbTime *) { |
| 28 |
Destructor. |
| 29 |
} |
| 30 |
END |
| 31 |
METHOD "" static SbTime getTimeOfDay() { |
| 32 |
Get the current time (seconds since Jan 1, 1970). |
| 33 |
} |
| 34 |
METHOD "" void setToTimeOfDay() { |
| 35 |
Set to the current time (seconds since Jan 1, 1970). |
| 36 |
} |
| 37 |
METHOD "" static SbTime zero() { |
| 38 |
Get a zero time. |
| 39 |
} |
| 40 |
METHOD "" static SbTime max() { |
| 41 |
Get a time far, far into the future. |
| 42 |
} |
| 43 |
METHOD setSec void setValue(double sec) { |
| 44 |
Set time from a double (in seconds). |
| 45 |
} |
| 46 |
METHOD setSecUSec void setValue(int32_t sec, long usec) { |
| 47 |
Set time from seconds + microseconds. |
| 48 |
} |
| 49 |
METHOD setTimeval void setValue(const struct timeval *tv) { |
| 50 |
Set time from a \astruct timeval\.. |
| 51 |
} |
| 52 |
METHOD setMSec void setMsecValue(unsigned long msec) { |
| 53 |
Set time from milliseconds. |
| 54 |
} |
| 55 |
METHOD getSec double getValue() const { |
| 56 |
Get time in seconds as a double. |
| 57 |
} |
| 58 |
METHOD getSecUSec void getValue(int32_t &sec, long &usec) const { |
| 59 |
Get time in seconds and microseconds. |
| 60 |
} |
| 61 |
METHOD getTimeval void getValue(struct timeval *tv) const { |
| 62 |
Get time in a \astruct timeval\.. |
| 63 |
} |
| 64 |
METHOD getMSec unsigned long getMsecValue() const { |
| 65 |
Get time in milliseconds (for Xt). |
| 66 |
} |
| 67 |
METHOD "" SbString format(const char *fmt = "%S.%i") const { |
| 68 |
Convert to a string. The default format is seconds with 3 digits of fraction |
| 69 |
precision. \afmt\. is a character string that consists of field descriptors and |
| 70 |
text characters, in a manner analogous to \ccftime (3C)\. and \cprintf (3S)\.. |
| 71 |
Each field descriptor consists of a % character followed by another character |
| 72 |
which specifies the replacement for the field descriptor. All other characters |
| 73 |
are copied from \afmt\. into the result. The following field descriptors are |
| 74 |
supported: |
| 75 |
\b |
| 76 |
|
| 77 |
% the `%' character |
| 78 |
D total number of days |
| 79 |
H total number of hours |
| 80 |
M total number of minutes |
| 81 |
S total number of seconds |
| 82 |
I total number of milliseconds |
| 83 |
U total number of microseconds |
| 84 |
h hours remaining after the days (00-23) |
| 85 |
m minutes remaining after the hours (00-59) |
| 86 |
s seconds remaining after the minutes (00-59) |
| 87 |
i milliseconds remaining after the seconds (000-999) |
| 88 |
u microseconds remaining after the seconds (000000-999999) |
| 89 |
\. |
| 90 |
The uppercase descriptors are formatted with a leading `\(em' for negative |
| 91 |
times; the lowercase descriptors are formatted fixed width, with leading |
| 92 |
zeros. For example, a reasonable format string might be |
| 93 |
"elapsed\ time:\ %M\ minutes,\ %s\ seconds". The default value of \afmt\., |
| 94 |
"%S.%i", formats the time as seconds with 3 digits of fractional precision. |
| 95 |
|
| 96 |
} |
| 97 |
METHOD "" SbString formatDate(const char *fmt = "%A, %D %r") const { |
| 98 |
Convert to a date string, interpreting the time as seconds since |
| 99 |
Jan 1, 1970. The default format gives "Tuesday, 01/26/93 11:23:41 AM". |
| 100 |
See the \ccftime()\. reference page for explanation of the format string. |
| 101 |
} |
| 102 |
METHOD "" SbTime operator +(const SbTime &t0, const SbTime &t1) {} |
| 103 |
METHOD "" SbTime operator -(const SbTime &t0, const SbTime &t1) { |
| 104 |
Addition and subtraction of two times. |
| 105 |
} |
| 106 |
METHOD "" SbTime & operator +=(const SbTime &tm) {} |
| 107 |
METHOD "" SbTime & operator -=(const SbTime &tm) { |
| 108 |
Addition and subtraction of two times which modifies the time structure. |
| 109 |
} |
| 110 |
METHOD negate SbTime operator -() const { |
| 111 |
Unary negation. |
| 112 |
} |
| 113 |
BEGIN C++ |
| 114 |
METHOD "" SbTime operator *(double s, const SbTime &tm) {} |
| 115 |
END |
| 116 |
METHOD "" SbTime operator *(const SbTime &tm, double s) {} |
| 117 |
METHOD "" SbTime operator /(const SbTime &tm, double s) { |
| 118 |
Multiplication and division by scalar. |
| 119 |
} |
| 120 |
METHOD "" SbTime & operator *=(double s) {} |
| 121 |
METHOD "" SbTime & operator /=(double s) { |
| 122 |
Destructive multiplication and division by scalar. |
| 123 |
} |
| 124 |
METHOD DivByTime double operator /(const SbTime &tm) const { |
| 125 |
Division by another time. |
| 126 |
} |
| 127 |
METHOD "" SbTime operator %(const SbTime &tm) const { |
| 128 |
Modulus for two times (remainder when time1 is divided by time2). |
| 129 |
} |
| 130 |
METHOD "" int operator ==(const SbTime &tm) const {} |
| 131 |
METHOD "" int operator !=(const SbTime &tm) const { |
| 132 |
Equality operators. |
| 133 |
} |
| 134 |
METHOD "" SbBool operator <(const SbTime &tm) const {} |
| 135 |
METHOD "" SbBool operator >(const SbTime &tm) const {} |
| 136 |
METHOD "" SbBool operator <=(const SbTime &tm) const {} |
| 137 |
METHOD "" SbBool operator >=(const SbTime &tm) const { |
| 138 |
Relational operators. |
| 139 |
} |
| 140 |
ALSO { cftime } |