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

Method getTimeMicroseconds

examples/Utils/b3Clock.cpp:152–184  ·  view source on GitHub ↗

Returns the time in us since the last call to reset or since the Clock was created.

Source from the content-addressed store, hash-verified

150/// Returns the time in us since the last call to reset or since
151/// the Clock was created.
152unsigned long long int b3Clock::getTimeMicroseconds()
153{
154#ifdef B3_USE_WINDOWS_TIMERS
155 //see https://msdn.microsoft.com/en-us/library/windows/desktop/dn553408(v=vs.85).aspx
156 LARGE_INTEGER currentTime, elapsedTime;
157
158 QueryPerformanceCounter(&currentTime);
159 elapsedTime.QuadPart = currentTime.QuadPart -
160 m_data->mStartTime.QuadPart;
161 elapsedTime.QuadPart *= 1000000;
162 elapsedTime.QuadPart /= m_data->mClockFrequency.QuadPart;
163
164 return (unsigned long long)elapsedTime.QuadPart;
165#else
166
167#ifdef __CELLOS_LV2__
168 uint64_t freq = sys_time_get_timebase_frequency();
169 double dFreq = ((double)freq) / 1000000.0;
170 typedef uint64_t ClockSize;
171 ClockSize newTime;
172 //__asm __volatile__( "mftb %0" : "=r" (newTime) : : "memory");
173 SYS_TIMEBASE_GET(newTime);
174
175 return (unsigned long int)((double(newTime - m_data->mStartTime)) / dFreq);
176#else
177
178 struct timeval currentTime;
179 gettimeofday(&currentTime, 0);
180 return (currentTime.tv_sec - m_data->mStartTime.tv_sec) * 1000000 +
181 (currentTime.tv_usec - m_data->mStartTime.tv_usec);
182#endif //__CELLOS_LV2__
183#endif
184}
185
186double b3Clock::getTimeInSeconds()
187{

Callers 14

TimedSortFunction · 0.45
b3Profile_Get_TicksFunction · 0.45
beginMethod · 0.45
endMethod · 0.45
ExampleBrowserThreadFuncFunction · 0.45
mainFunction · 0.45
stepSimulationMethod · 0.45
enqueueCommandMethod · 0.45
UDPThreadFuncFunction · 0.45
TCPThreadFuncFunction · 0.45
MotionThreadFuncFunction · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected