20 lines
890 B
C
20 lines
890 B
C
// calogTime.h -- calog time library.
|
|
//
|
|
// A tiny, stateless clock + sleep bridge, so any engine can read the wall-clock and
|
|
// monotonic clocks and block for a while without an engine-specific library:
|
|
// timeNow() -> real (epoch seconds, fractional; CLOCK_REALTIME)
|
|
// timeMonotonic() -> real (seconds from an unspecified origin; CLOCK_MONOTONIC)
|
|
// timeSleep(ms) -> nil (block the calling context for ms milliseconds)
|
|
// The natives are INLINE (pure clock reads / a plain blocking sleep, no shared state, no
|
|
// timers or threads), so there is nothing to shut down.
|
|
|
|
#ifndef CALOG_TIME_H
|
|
#define CALOG_TIME_H
|
|
|
|
#include "calog.h"
|
|
|
|
// Register the time natives (timeNow, timeMonotonic, timeSleep) on a runtime. Stateless:
|
|
// safe to call on any number of runtimes, and there is no matching shutdown.
|
|
int32_t calogTimeRegister(CalogT *calog);
|
|
|
|
#endif
|