00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 INLINE ClockObject::
00021 ~ClockObject() {
00022 }
00023
00024
00025
00026
00027
00028
00029
00030 INLINE ClockObject::Mode ClockObject::
00031 get_mode() const {
00032 return _mode;
00033 }
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047 INLINE double ClockObject::
00048 get_frame_time(Thread *current_frame) const {
00049 CDReader cdata(_cycler, current_frame);
00050 return cdata->_reported_frame_time;
00051 }
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067 INLINE double ClockObject::
00068 get_real_time() const {
00069 return (_true_clock->get_short_time() - _start_short_time);
00070 }
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086 INLINE double ClockObject::
00087 get_long_time() const {
00088 return (_true_clock->get_long_time() - _start_long_time);
00089 }
00090
00091
00092
00093
00094
00095
00096
00097 INLINE void ClockObject::
00098 reset() {
00099 set_real_time(0.0);
00100 set_frame_time(0.0);
00101 set_frame_count(0);
00102 }
00103
00104
00105
00106
00107
00108
00109
00110
00111
00112 INLINE int ClockObject::
00113 get_frame_count(Thread *current_thread) const {
00114 CDReader cdata(_cycler, current_thread);
00115 return cdata->_frame_count;
00116 }
00117
00118
00119
00120
00121
00122
00123
00124
00125
00126
00127 INLINE double ClockObject::
00128 get_net_frame_rate(Thread *current_thread) const {
00129 CDReader cdata(_cycler, current_thread);
00130 return (double)cdata->_frame_count / cdata->_reported_frame_time;
00131 }
00132
00133
00134
00135
00136
00137
00138
00139
00140 INLINE double ClockObject::
00141 get_dt(Thread *current_thread) const {
00142 CDReader cdata(_cycler, current_thread);
00143 if (_max_dt > 0.0) {
00144 return min(_max_dt, cdata->_dt);
00145 }
00146 return cdata->_dt;
00147 }
00148
00149
00150
00151
00152
00153
00154
00155 INLINE double ClockObject::
00156 get_max_dt() const {
00157 return _max_dt;
00158 }
00159
00160
00161
00162
00163
00164
00165
00166
00167
00168
00169
00170
00171
00172
00173
00174
00175
00176
00177 INLINE void ClockObject::
00178 set_max_dt(double max_dt) {
00179 _max_dt = max_dt;
00180 }
00181
00182
00183
00184
00185
00186
00187
00188
00189
00190
00191
00192 INLINE double ClockObject::
00193 get_degrade_factor() const {
00194 return _degrade_factor;
00195 }
00196
00197
00198
00199
00200
00201
00202
00203
00204
00205
00206
00207 INLINE void ClockObject::
00208 set_degrade_factor(double degrade_factor) {
00209 _degrade_factor = degrade_factor;
00210 }
00211
00212
00213
00214
00215
00216
00217
00218
00219
00220
00221
00222
00223
00224
00225 INLINE void ClockObject::
00226 set_average_frame_rate_interval(double time) {
00227 _average_frame_rate_interval = time;
00228 if (_average_frame_rate_interval == 0.0) {
00229 _ticks.clear();
00230 }
00231 }
00232
00233
00234
00235
00236
00237
00238
00239
00240 INLINE double ClockObject::
00241 get_average_frame_rate_interval() const {
00242 return _average_frame_rate_interval;
00243 }
00244
00245
00246
00247
00248
00249
00250
00251
00252
00253
00254
00255 INLINE bool ClockObject::
00256 check_errors(Thread *current_thread) {
00257 CDReader cdata(_cycler, current_thread);
00258 int orig_error_count = _error_count;
00259 _error_count = _true_clock->get_error_count();
00260 return (_error_count != orig_error_count);
00261 }
00262
00263
00264
00265
00266
00267
00268
00269
00270 INLINE ClockObject *ClockObject::
00271 get_global_clock() {
00272 if (_global_clock == (ClockObject *)NULL) {
00273 make_global_clock();
00274 }
00275 return _global_clock;
00276 }
00277
00278
00279
00280
00281
00282
00283 INLINE ClockObject::CData::
00284 CData(const ClockObject::CData ©) :
00285 _frame_count(copy._frame_count),
00286 _reported_frame_time(copy._reported_frame_time),
00287 _dt(copy._dt)
00288 {
00289 }
00290
00291
00292
00293
00294
00295
00296 INLINE TimeVal::
00297 TimeVal() {
00298 }
00299
00300
00301
00302
00303
00304
00305 INLINE ulong TimeVal::
00306 get_sec() const {
00307 return tv[0];
00308 }
00309
00310
00311
00312
00313
00314
00315 INLINE ulong TimeVal::
00316 get_usec() const {
00317 return tv[1];
00318 }