/* * wtime, short for wall time, count the time in nanoseconds elapsed * since 1970/1/1, 0:0:0am. It maintains a strict relationship with * mtime as follows: * * wtime = epoch + mtime * * where epoch is the initial wtime when machine starts. * * It is a 64-bit variable counted in units of nanoseconds, which gives * ~584 - years. * * wtime is implemented on top of mtime. Whenever mtime advances * wtime advances naturally due to the fixed difference between them. * * wtime can be changed. No monotonicity is assumed. * * wtimers are timers that expire in wtime. The callback of wtimer * when it expires is run in a process context (a daemon). * * Read/write of wtime is guarded by a reader/writer semaphore. Callbacks * of wtimer are executed with reader semaphore acquired. One must * acquire writer semaphore to change wtime, which implies wtime can * only be changed from process context. */ #ifndef _LINUX_MTIME_H #define _LINUX_MTIME_H #include #include extern u64 wtime_epoch; /* * latch mtime and return current wtime */ u64 wtime_get(void); /* * return current epoch value */ u64 wtime_get_epoch(void); /* * Set wtime. Must acquire writer semaphore first. */ int wtime_set(u64); /* * wtimers */ void wtimer_add(struct wtimer_struct *); void wtimer_del(struct wtimer_struct *); void wtimer_mod(struct wtimer_struct *, u64 new_expire); #endif