MCPcopy Create free account
hub / github.com/culvertsoft/mgen / getTimeNanos

Function getTimeNanos

mgen-cpplib/src/test/cpp/src/OsTime.cpp:59–69  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

57#include <mach/mach.h>
58
59static int64_t getTimeNanos() {
60 struct timespec ts;
61 clock_serv_t cclock;
62 mach_timespec_t mts;
63 host_get_clock_service(mach_host_self(), CALENDAR_CLOCK, &cclock);
64 clock_get_time(cclock, &mts);
65 mach_port_deallocate(mach_task_self(), cclock);
66 ts.tv_sec = mts.tv_sec;
67 ts.tv_nsec = mts.tv_nsec;
68 return (uint64_t(ts.tv_sec) * 1000000000LL) + ts.tv_nsec;
69}
70
71static const uint64_t s_t0 = getTimeNanos();
72

Callers 2

OsTime.cppFile · 0.85
getCurTimeSecondsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected