2018-04-01 17:16:11 +00:00
|
|
|
/*
|
|
|
|
| time.h from Lsyncd -- the Live (Mirror) Syncing Demon
|
|
|
|
|
|
|
|
|
| Time keeping.
|
|
|
|
|
|
|
|
|
| License: GPLv2 (see COPYING) or any later version
|
|
|
|
| Authors: Axel Kittenberger <axkibe@gmail.com>
|
|
|
|
*/
|
|
|
|
#ifndef LSYNCD_TIME_H
|
|
|
|
#define LSYNCD_TIME_H
|
|
|
|
|
|
|
|
// time comparisons - wrap around safe
|
|
|
|
#define time_after(a,b) ((long)(b) - (long)(a) < 0)
|
|
|
|
#define time_before(a,b) time_after(b,a)
|
|
|
|
#define time_after_eq(a,b) ((long)(a) - (long)(b) >= 0)
|
|
|
|
#define time_before_eq(a,b) time_after_eq(b,a)
|
|
|
|
|
2018-04-03 06:59:04 +00:00
|
|
|
|
|
|
|
// The kernel's clock ticks per second.
|
|
|
|
extern long clocks_per_sec;
|
|
|
|
|
2018-06-06 07:24:13 +00:00
|
|
|
|
2018-04-01 17:16:11 +00:00
|
|
|
// Returns the current time.
|
|
|
|
extern clock_t now( );
|
|
|
|
|
2018-06-06 07:24:13 +00:00
|
|
|
|
2018-04-01 17:16:11 +00:00
|
|
|
// Returns (on Lua stack) the current kernels clock state( jiffies ).
|
|
|
|
extern int l_now(lua_State *L);
|
|
|
|
|
2018-06-06 07:24:13 +00:00
|
|
|
|
2018-04-01 17:16:11 +00:00
|
|
|
// Registers the jiffies meta table in a Lua state.
|
|
|
|
extern void register_jiffies( lua_State *L );
|
|
|
|
|
2018-06-06 07:24:13 +00:00
|
|
|
|
2018-04-01 17:16:11 +00:00
|
|
|
#endif
|