Fix time
This commit is contained in:
parent
641ab17995
commit
9ae5931db7
@ -6,6 +6,7 @@
|
||||
#include <unistd.h>
|
||||
#include <sys/time.h>
|
||||
#include <glib.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#define INLINE static inline
|
||||
#define UNUSED(x) ((void)(x))
|
||||
@ -192,7 +193,9 @@ INLINE void vehicle_hard_right(trial *t) {
|
||||
INLINE timestamp getcurts(trial *t) {
|
||||
struct timeval tv;
|
||||
gettimeofday(&tv, NULL);
|
||||
return (tv.tv_sec - t->started.tv_sec) * 1000 + (tv.tv_usec - t->started.tv_sec) / 1000;
|
||||
timestamp ts = (tv.tv_sec - t->started.tv_sec) * 1000 + (tv.tv_usec - t->started.tv_usec) / 1000;
|
||||
printf("Timestamp: %u\n", ts);
|
||||
return ts;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -387,9 +387,9 @@ _match:
|
||||
if (!t->alive) {
|
||||
t->vehicle.accel = ctx->tm->vehicle.accel;
|
||||
t->vehicle.turn = ctx->tm->vehicle.turn;
|
||||
gettimeofday(&t->started, NULL);
|
||||
}
|
||||
t->last_ts = ctx->tm->ts;
|
||||
gettimeofday(&t->started, NULL);
|
||||
ctx->tm = NULL;
|
||||
t->alive = 1;
|
||||
}
|
||||
|
@ -39,9 +39,9 @@ static timestamp extract_ts(context *ctx, char *fpc) {
|
||||
if (!t->alive) {
|
||||
t->vehicle.accel = ctx->tm->vehicle.accel;
|
||||
t->vehicle.turn = ctx->tm->vehicle.turn;
|
||||
gettimeofday(&t->started, NULL);
|
||||
}
|
||||
t->last_ts = ctx->tm->ts;
|
||||
gettimeofday(&t->started, NULL);
|
||||
ctx->tm = NULL;
|
||||
t->alive = 1;
|
||||
}
|
||||
|
@ -59,7 +59,7 @@ void path_execute(trial* t,path* p){
|
||||
return;
|
||||
}
|
||||
|
||||
now = timestamp_get_curts(t);
|
||||
now = getcurts(t);
|
||||
/*fprintf(stderr,"Now: %d TS: %d\n",now,clock());*/
|
||||
/*magic number for latency, send messages that much earlier*/
|
||||
while(tmp != NULL && now - 20 > tmp->ts){
|
||||
|
Loading…
Reference in New Issue
Block a user