1SbTime(3IV)()                                                    SbTime(3IV)()
2
3
4

NAME

6       SbTime — class for representation of a time
7

INHERITS FROM

9       SbTime
10

SYNOPSIS

12       #include <Inventor/SbTime.h>
13
14          Methods from class SbTime:
15
16                         SbTime()
17                         SbTime(double sec)
18                         SbTime(int32_t sec, long usec)
19                         SbTime(const struct timeval *tv)
20     static SbTime       getTimeOfDay()
21     void                setToTimeOfDay()
22     static SbTime       zero()
23     static SbTime       max()
24     void                setValue(double sec)
25     void                setValue(int32_t sec, long usec)
26     void                setValue(const struct timeval *tv)
27     void                setMsecValue(unsigned long msec)
28     double              getValue() const
29     void                getValue(int32_t &sec, long &usec) const
30     void                getValue(struct timeval *tv) const
31     unsigned long       getMsecValue() const
32     SbString            format(const char *fmt = "%S.%i") const
33     SbString            formatDate(const char *fmt = "%A, %D %r") const
34     SbTime              operator +(const SbTime &t0, const SbTime &t1)
35     SbTime              operator -(const SbTime &t0, const SbTime &t1)
36     SbTime &            operator +=(const SbTime &tm)
37     SbTime &            operator -=(const SbTime &tm)
38     SbTime              operator -() const
39     SbTime              operator *(double s, const SbTime &tm)
40     SbTime              operator *(const SbTime &tm, double s)
41     SbTime              operator /(const SbTime &tm, double s)
42     SbTime &            operator *=(double s)
43     SbTime &            operator /=(double s)
44     double              operator /(const SbTime &tm) const
45     SbTime              operator %(const SbTime &tm) const
46     int                 operator ==(const SbTime &tm) const
47     int                 operator !=(const SbTime &tm) const
48     SbBool              operator <(const SbTime &tm) const
49     SbBool              operator >(const SbTime &tm) const
50     SbBool              operator <=(const SbTime &tm) const
51     SbBool              operator >=(const SbTime &tm) const
52
53

DESCRIPTION

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

METHODS

60                         SbTime()
61                         SbTime(double sec)
62                         SbTime(int32_t sec, long usec)
63                         SbTime(const struct timeval *tv)
64          Constructors  taking  seconds, seconds and microseconds, or a struct
65          timeval.  NOTE that an integer parameter will not automatically cast
66          to  a  double  to  invoke  the  constructor taking seconds; that is,
67          SbTime(1) will result in a compilation error.  SbTime(1.0)  must  be
68          used  instead.  This is to avoid errors in upgrading from an earlier
69          release, in which  SbTime(1)  had  different  semantics.  In  future
70          releases,  this  distinction  will  be eliminated, and the effect of
71          SbTime(1.0) and that of SbTime(1) will be identical.
72
73     static SbTime       getTimeOfDay()
74          Get the current time (seconds since Jan 1, 1970).
75
76     void                setToTimeOfDay()
77          Set to the current time (seconds since Jan 1, 1970).
78
79     static SbTime       zero()
80          Get a zero time.
81
82     static SbTime       max()
83          Get a time far, far into the future.
84
85     void                setValue(double sec)
86          Set time from a double (in seconds).
87
88     void                setValue(int32_t sec, long usec)
89          Set time from seconds + microseconds.
90
91     void                setValue(const struct timeval *tv)
92          Set time from a struct timeval.
93
94     void                setMsecValue(unsigned long msec)
95          Set time from milliseconds.
96
97     double              getValue() const
98          Get time in seconds as a double.
99
100     void                getValue(int32_t &sec, long &usec) const
101          Get time in seconds and microseconds.
102
103     void                getValue(struct timeval *tv) const
104          Get time in a struct timeval.
105
106     unsigned long       getMsecValue() const
107          Get time in milliseconds (for Xt).
108
109     SbString            format(const char *fmt = "%S.%i") const
110          Convert to a string. The default format is seconds with 3 digits  of
111          fraction precision. fmt is a character string that consists of field
112          descriptors and text characters, in a  manner  analogous  to  cftime
113          (3C)  and printf (3S). Each field descriptor consists of a % charac‐
114          ter followed by another character which  specifies  the  replacement
115          for  the  field descriptor. All other characters are copied from fmt
116          into the result. The following field descriptors are supported:
117
118
119               %   the `%' character
120               D   total number of days
121               H   total number of hours
122               M   total number of minutes
123               S   total number of seconds
124               I   total number of milliseconds
125               U   total number of microseconds
126               h   hours remaining after the days (00-23)
127               m   minutes remaining after the hours (00-59)
128               s   seconds remaining after the minutes (00-59)
129               i   milliseconds remaining after the seconds (000-999)
130               u   microseconds remaining after the seconds (000000-999999)
131
132          The uppercase descriptors are formatted with a leading `—' for nega‐
133          tive  times;  the  lowercase  descriptors are formatted fixed width,
134          with leading zeros. For example, a reasonable format string might be
135          "elapsed time: %M minutes, %s seconds".  The  default  value of fmt,
136          "%S.%i", formats the time as seconds with  3  digits  of  fractional
137          precision.
138
139     SbString            formatDate(const char *fmt = "%A, %D %r") const
140          Convert to a date string, interpreting the time as seconds since Jan
141          1, 1970. The default format gives "Tuesday, 01/26/93  11:23:41  AM".
142          See  the  cftime()  reference  page  for  explanation  of the format
143          string.
144
145     SbTime              operator +(const SbTime &t0, const SbTime &t1)
146     SbTime              operator -(const SbTime &t0, const SbTime &t1)
147          Addition and subtraction of two times.
148
149     SbTime &            operator +=(const SbTime &tm)
150     SbTime &            operator -=(const SbTime &tm)
151          Addition and subtraction of two times which modifies the time struc‐
152          ture.
153
154     SbTime              operator -() const
155          Unary negation.
156
157     SbTime              operator *(double s, const SbTime &tm)
158     SbTime              operator *(const SbTime &tm, double s)
159     SbTime              operator /(const SbTime &tm, double s)
160          Multiplication and division by scalar.
161
162     SbTime &            operator *=(double s)
163     SbTime &            operator /=(double s)
164          Destructive multiplication and division by scalar.
165
166     double              operator /(const SbTime &tm) const
167          Division by another time.
168
169     SbTime              operator %(const SbTime &tm) const
170          Modulus for two times (remainder when time1 is divided by time2).
171
172     int                 operator ==(const SbTime &tm) const
173     int                 operator !=(const SbTime &tm) const
174          Equality operators.
175
176     SbBool              operator <(const SbTime &tm) const
177     SbBool              operator >(const SbTime &tm) const
178     SbBool              operator <=(const SbTime &tm) const
179     SbBool              operator >=(const SbTime &tm) const
180          Relational operators.
181
182

SEE ALSO

184       cftime
185
186
187
188
189                                                                 SbTime(3IV)()
Impressum