1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
|
#include "../Common/Common.h"
#include "Timer.h"
#include "DasherControl.h"
#include <sys/time.h>
gint timer_callback(gpointer data) {
return static_cast < CDasherControl * >(data)->TimerEvent();
}
gint long_timer_callback(gpointer data) {
return static_cast < CDasherControl * >(data)->LongTimerEvent();
}
long get_time() {
// We need to provide a monotonic time source that ticks every millisecond
long s_now;
long ms_now;
struct timeval tv;
struct timezone tz;
gettimeofday(&tv, &tz);
s_now = tv.tv_sec;
ms_now = tv.tv_usec / 1000;
return (s_now * 1000 + ms_now);
}
|