MCPcopy Create free account
hub / github.com/bulletphysics/bullet3 / getTimeMilliseconds

Method getTimeMilliseconds

examples/Utils/b3Clock.cpp:117–148  ·  view source on GitHub ↗

Returns the time in ms since the last call to reset or since the b3Clock was created.

Source from the content-addressed store, hash-verified

115/// Returns the time in ms since the last call to reset or since
116/// the b3Clock was created.
117unsigned long int b3Clock::getTimeMilliseconds()
118{
119#ifdef B3_USE_WINDOWS_TIMERS
120 LARGE_INTEGER currentTime;
121 QueryPerformanceCounter(&currentTime);
122 LONGLONG elapsedTime = currentTime.QuadPart -
123 m_data->mStartTime.QuadPart;
124 // Compute the number of millisecond ticks elapsed.
125 unsigned long msecTicks = (unsigned long)(1000 * elapsedTime /
126 m_data->mClockFrequency.QuadPart);
127
128 return msecTicks;
129#else
130
131#ifdef __CELLOS_LV2__
132 uint64_t freq = sys_time_get_timebase_frequency();
133 double dFreq = ((double)freq) / 1000.0;
134 typedef uint64_t ClockSize;
135 ClockSize newTime;
136 SYS_TIMEBASE_GET(newTime);
137 //__asm __volatile__( "mftb %0" : "=r" (newTime) : : "memory");
138
139 return (unsigned long int)((double(newTime - m_data->mStartTime)) / dFreq);
140#else
141
142 struct timeval currentTime;
143 gettimeofday(&currentTime, 0);
144 return (currentTime.tv_sec - m_data->mStartTime.tv_sec) * 1000 +
145 (currentTime.tv_usec - m_data->mStartTime.tv_usec) / 1000;
146#endif //__CELLOS_LV2__
147#endif
148}
149
150/// Returns the time in us since the last call to reset or since
151/// the Clock was created.

Callers 11

rendermeMethod · 0.45
castMethod · 0.45
initPhysicsMethod · 0.45
stepSimulationMethod · 0.45
performMaxStepMethod · 0.45
MotionThreadFuncFunction · 0.45
processServerStatusMethod · 0.45
processServerStatusMethod · 0.45
castMethod · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected