Add usleep to strain.c just in case...
[matches/MCTX3420.git] / server / common.h
1 /**
2  * @file common.h
3  * @brief Common header includes
4  */
5
6 #ifndef _COMMON_H
7 #define _COMMON_H
8
9 /** Defines required to allow various C standard functions to be used **/
10 #define _POSIX_C_SOURCE 200809L
11 //#define _BSD_SOURCE
12 #define _XOPEN_SOURCE 600
13 #define _GNU_SOURCE
14 /** Determine if we're running on the BBB **/
15 #ifdef __arm__
16         #define _BBB
17 #else
18         //#warning This software was designed for the BeagleBone Black. Some features may not work.
19 #endif //__arm__
20
21 /** The current API version **/
22 #define API_VERSION 0
23
24 //#define REALTIME_VERSION
25
26
27
28 #include <stdlib.h>
29 #include <stdio.h>
30 #include <stdbool.h>
31 #include <string.h>
32 #include <errno.h>
33 #include <pthread.h>
34 #include <unistd.h>
35 #include <assert.h>
36 #include <sys/time.h>
37 #include <time.h>
38 #include <string.h>
39
40 #include "log.h"
41 #include "fastcgi.h"
42 #include "control.h"
43
44 /**Converts a timeval to a double**/
45 #define TIMEVAL_TO_DOUBLE(tv) ((tv).tv_sec + 1e-9 * ((tv).tv_nsec))
46 /**Takes the tv1-tv2 between two timevals and returns the result as a double*/
47 #define TIMEVAL_DIFF(tv1, tv2) ((tv1).tv_sec - (tv2).tv_sec + 1e-9 * ((tv1).tv_nsec - (tv2).tv_nsec))
48 /** Converts a double time value (in seconds) to a timespec **/
49 #define DOUBLE_TO_TIMEVAL(value, tv) {  \
50                                                                                 (tv)->tv_sec = (int)(value); \
51                                                                                 (tv)->tv_nsec = ((value) - (int)(value))*1e9; \
52                                                                         }
53
54 extern bool PathExists(const char * path);
55 extern bool DirExists(const char * path);
56
57
58
59 #endif //_COMMON_H

UCC git Repository :: git.ucc.asn.au