14 #if defined(URG_WINDOWS_OS) 22 static int is_initialized = 0;
23 #if defined(URG_WINDOWS_OS) 24 static clock_t first_clock;
25 clock_t current_clock;
27 static struct timeval first_time;
28 struct timeval current_time;
32 #if defined(URG_WINDOWS_OS) 33 if (!is_initialized) {
34 first_clock = clock();
37 current_clock = clock();
38 msec_time = (current_clock - first_clock) * 1000 / CLOCKS_PER_SEC;
40 if (!is_initialized) {
41 gettimeofday(&first_time, NULL);
44 gettimeofday(¤t_time, NULL);
47 ((current_time.tv_sec - first_time.tv_sec) * 1000) +
48 ((current_time.tv_usec - first_time.tv_usec) / 1000);
60 long sensor_time_stamp;
62 long before_pc_time_stamp;
63 long after_pc_time_stamp;
71 delay = (after_pc_time_stamp - before_pc_time_stamp) / 2;
73 if (sensor_time_stamp < 0) {
74 printf(
"urg_time_stamp: %s\n",
urg_error(urg));
77 sensor_time_stamp -= time_stamp_offset;
82 printf(
"%ld,\t%ld\n", pc_time_stamp, sensor_time_stamp);
84 return sensor_time_stamp - (pc_time_stamp - delay);
88 int main(
int argc,
char *argv[])
91 TIME_STAMP_PRINT_TIMES = 5,
95 long time_stamp_offset;
102 printf(
"# pc,\tsensor\n");
108 for (i = 0; i < TIME_STAMP_PRINT_TIMES; ++i) {
int urg_start_time_stamp_mode(urg_t *urg)
long urg_time_stamp(urg_t *urg)
const char * urg_error(const urg_t *urg)
void urg_close(urg_t *urg)
int main(int argc, char *argv[])
static long print_time_stamp(urg_t *urg, long time_stamp_offset)
int open_urg_sensor(urg_t *urg, int argc, char *argv[])
static int pc_msec_time(void)
int urg_stop_time_stamp_mode(urg_t *urg)