MCPcopy Create free account
hub / github.com/android/ndk-samples / Clock

Function Clock

endless-tunnel/app/src/main/cpp/util.cpp:32–46  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

30}
31
32float Clock() {
33 static struct timespec _base;
34 static bool firstCall = true;
35
36 if (firstCall) {
37 clock_gettime(CLOCK_MONOTONIC, &_base);
38 firstCall = false;
39 }
40
41 struct timespec t;
42 clock_gettime(CLOCK_MONOTONIC, &t);
43 float secDiff = (float)(t.tv_sec - _base.tv_sec);
44 float msecDiff = (float)((t.tv_nsec - _base.tv_nsec) / 1000000);
45 return secDiff + 0.001f * msecDiff;
46}
47
48float SineWave(float min, float max, float period, float phase) {
49 float ampl = max - min;

Callers 14

OnStartGraphicsMethod · 0.85
DoFrameMethod · 0.85
ShowSignMethod · 0.85
SineWaveFunction · 0.85
BlinkFuncFunction · 0.85
SetWaitScreenMethod · 0.85
DeltaClockMethod · 0.85
ReadDeltaMethod · 0.85
ResetMethod · 0.85
PlaySceneMethod · 0.85
DoFrameMethod · 0.85
RenderObstaclesMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected