Lucciefr
Lua code caving, injection and exploration framework
timing.h
Go to the documentation of this file.
1 
3 #ifndef TIMING_H
4 #define TIMING_H
5 
6 #include "bool.h"
7 #include <sys/types.h>
8 
9 double get_elapsed(void);
10 double get_elapsed_ms(void);
11 double get_timestamp(void);
12 
13 size_t format_timestamp(char *buffer, size_t len, const char *format,
14  double timestamp, bool local);
15 
16 // If we're not on Windows, provide a substitute for the Sleep() function
17 #if !_WINDOWS
18  #include <unistd.h>
20  #define Sleep(ms) usleep((ms) * 1000)
21 #else
22  #include <windows.h>
23 #endif
24 
25 #endif // TIMING_H
size_t format_timestamp(char *buffer, size_t len, const char *format, double timestamp, bool local)
convert timestamp to string with a given format
Definition: timing.c:86
double get_elapsed(void)
return elapsed time in seconds (with a "high-resolution" fractional part!)
Definition: timing.c:43
double get_timestamp(void)
return high-resolution timestamp in seconds since the Epoch (1970-01-01 00:00:00 UTC) ...
Definition: timing.c:73
boolean data type and constants/macros
double get_elapsed_ms(void)
return elapsed time in milliseconds (= 1000.0 * get_elapsed())
Definition: timing.c:63