| 30 | } |
| 31 | |
| 32 | float 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 | |
| 48 | float SineWave(float min, float max, float period, float phase) { |
| 49 | float ampl = max - min; |
no outgoing calls
no test coverage detected