Lucciefr
Lua code caving, injection and exploration framework
Macros | Functions
timing.h File Reference
#include "bool.h"
#include <sys/types.h>
#include <unistd.h>

Go to the source code of this file.

Macros

#define Sleep(ms)   usleep((ms) * 1000)
 delay for a given interval (number of milliseconds)
 

Functions

double get_elapsed (void)
 return elapsed time in seconds (with a "high-resolution" fractional part!)
 
double get_elapsed_ms (void)
 return elapsed time in milliseconds (= 1000.0 * get_elapsed())
 
double get_timestamp (void)
 return high-resolution timestamp in seconds since the Epoch (1970-01-01 00:00:00 UTC) More...
 
size_t format_timestamp (char *buffer, size_t len, const char *format, double timestamp, bool local)
 convert timestamp to string with a given format More...
 

Function Documentation

size_t format_timestamp ( char *  buffer,
size_t  len,
const char *  format,
double  timestamp,
bool  local 
)

convert timestamp to string with a given format

This function uses strftime() internally and accepts the same format specifiers, with one exception: A ".qqq" substring will get replaced with the milliseconds part of timestamp. The letter 'q' was chosen on purpose, because it's not a valid strftime() conversion specification.

double get_timestamp ( void  )
inline

return high-resolution timestamp in seconds since the Epoch (1970-01-01 00:00:00 UTC)

Note
There's no "timezone" / localtime() involved here, you'd have to adjust for that yourself. (This is desired, so our timestamps are UTC-based and not affected by local time zone or daylight savings transitions!)