structering the core some more

This commit is contained in:
Axel Kittenberger 2018-04-01 19:16:11 +02:00
parent 902b2c77cd
commit 4af469854e
1 changed files with 29 additions and 0 deletions

29
core/time.h Normal file
View File

@ -0,0 +1,29 @@
/*
| 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)
// Returns the current time.
extern clock_t now( );
// Returns (on Lua stack) the current kernels clock state( jiffies ).
extern int l_now(lua_State *L);
// Registers the jiffies meta table in a Lua state.
extern void register_jiffies( lua_State *L );
#endif