MCPcopy Create free account
hub / github.com/VCVRack/Rack / initTime

Function initTime

src/system.cpp:740–762  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

738#endif
739
740static void initTime() {
741#if defined ARCH_WIN
742 LARGE_INTEGER counter;
743 QueryPerformanceCounter(&counter);
744 startCounter = counter.QuadPart;
745
746 LARGE_INTEGER frequency;
747 QueryPerformanceFrequency(&frequency);
748 counterTime = 1.0 / frequency.QuadPart;
749#endif
750#if defined ARCH_LIN
751 struct timespec ts;
752 clock_gettime(CLOCK_MONOTONIC_RAW, &ts);
753 startTime = int64_t(ts.tv_sec) * 1000000000LL + ts.tv_nsec;
754#endif
755#if defined ARCH_MAC
756 startCounter = mach_absolute_time();
757
758 mach_timebase_info_data_t tb;
759 mach_timebase_info(&tb);
760 counterTime = 1e-9 * (double) tb.numer / tb.denom;
761#endif
762}
763
764
765double getTime() {

Callers 1

initFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected