X-Git-Url: https://git.ucc.asn.au/?a=blobdiff_plain;f=server%2Fcommon.h;h=0875b34e1337ca60f74b9a8b5b657ba6e689f80b;hb=6bc90047ed36b392d90a1bf778baf9687b835f2d;hp=2a6184a73784af08858f9c6a45b1b7efcac25897;hpb=259624013535f3c93315868efb5f6f611ba88470;p=matches%2FMCTX3420.git diff --git a/server/common.h b/server/common.h index 2a6184a..0875b34 100644 --- a/server/common.h +++ b/server/common.h @@ -1,13 +1,29 @@ /** * @file common.h - * @purpose Common header includes + * @brief Common header includes */ #ifndef _COMMON_H #define _COMMON_H +/** Defines required to allow various C standard functions to be used **/ #define _POSIX_C_SOURCE 200809L -#define _BSD_SOURCE +//#define _BSD_SOURCE +#define _XOPEN_SOURCE 600 +#define _GNU_SOURCE +/** Determine if we're running on the BBB **/ +#ifdef __arm__ + #define _BBB +#else + //#warning This software was designed for the BeagleBone Black. Some features may not work. +#endif //__arm__ + +/** The current API version **/ +#define API_VERSION 0 + +//#define REALTIME_VERSION + + #include #include @@ -16,5 +32,28 @@ #include #include #include +#include +#include +#include +#include + +#include "log.h" +#include "fastcgi.h" +#include "control.h" + +/**Converts a timeval to a double**/ +#define TIMEVAL_TO_DOUBLE(tv) ((tv).tv_sec + 1e-9 * ((tv).tv_nsec)) +/**Takes the tv1-tv2 between two timevals and returns the result as a double*/ +#define TIMEVAL_DIFF(tv1, tv2) ((tv1).tv_sec - (tv2).tv_sec + 1e-9 * ((tv1).tv_nsec - (tv2).tv_nsec)) +/** Converts a double time value (in seconds) to a timespec **/ +#define DOUBLE_TO_TIMEVAL(value, tv) { \ + (tv)->tv_sec = (int)(value); \ + (tv)->tv_nsec = ((value) - (int)(value))*1e9; \ + } + +extern bool PathExists(const char * path); +extern bool DirExists(const char * path); + + #endif //_COMMON_H