tagging release
[dasher.git] / trunk / Src / Gtk2 / Timer.cpp
blob269e456297daf5e3484baaafe437776037106b37
1 #include "../Common/Common.h"
3 #include "Timer.h"
4 #include "DasherControl.h"
6 #include <sys/time.h>
8 gint timer_callback(gpointer data) {
9 return static_cast < CDasherControl * >(data)->TimerEvent();
12 gint long_timer_callback(gpointer data) {
13 return static_cast < CDasherControl * >(data)->LongTimerEvent();
16 long get_time() {
17 // We need to provide a monotonic time source that ticks every millisecond
18 long s_now;
19 long ms_now;
21 struct timeval tv;
22 struct timezone tz;
24 gettimeofday(&tv, &tz);
26 s_now = tv.tv_sec;
27 ms_now = tv.tv_usec / 1000;
29 return (s_now * 1000 + ms_now);