Commit df5afaa9 authored by Cedric Roux's avatar Cedric Roux

store received time in events for later processing

parent e5689a5b
...@@ -4,13 +4,21 @@ ...@@ -4,13 +4,21 @@
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#ifdef T_SEND_TIME
event new_event(struct timespec sending_time, int type,
int length, char *buffer, void *database)
#else
event new_event(int type, int length, char *buffer, void *database) event new_event(int type, int length, char *buffer, void *database)
#endif
{ {
database_event_format f; database_event_format f;
event e; event e;
int i; int i;
int offset; int offset;
#ifdef T_SEND_TIME
e.sending_time = sending_time;
#endif
e.type = type; e.type = type;
e.buffer = buffer; e.buffer = buffer;
......
...@@ -2,6 +2,9 @@ ...@@ -2,6 +2,9 @@
#define _EVENT_H_ #define _EVENT_H_
#include "../T_defs.h" #include "../T_defs.h"
#ifdef T_SEND_TIME
#include <time.h>
#endif
enum event_arg_type { enum event_arg_type {
EVENT_INT, EVENT_INT,
...@@ -23,12 +26,20 @@ typedef struct { ...@@ -23,12 +26,20 @@ typedef struct {
} event_arg; } event_arg;
typedef struct { typedef struct {
#ifdef T_SEND_TIME
struct timespec sending_time;
#endif
int type; int type;
char *buffer; char *buffer;
event_arg e[T_MAX_ARGS]; event_arg e[T_MAX_ARGS];
int ecount; int ecount;
} event; } event;
#ifdef T_SEND_TIME
event new_event(struct timespec sending_time, int type,
int length, char *buffer, void *database);
#else
event new_event(int type, int length, char *buffer, void *database); event new_event(int type, int length, char *buffer, void *database);
#endif
#endif /* _EVENT_H_ */ #endif /* _EVENT_H_ */
...@@ -99,7 +99,11 @@ event get_event(int s, char *v, void *d) ...@@ -99,7 +99,11 @@ event get_event(int s, char *v, void *d)
length -= sizeof(int); length -= sizeof(int);
fullread(s, v, length); fullread(s, v, length);
#ifdef T_SEND_TIME
return new_event(t, type, length, v, d);
#else
return new_event(type, length, v, d); return new_event(type, length, v, d);
#endif
} }
static void *gui_thread(void *_g) static void *gui_thread(void *_g)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment