source: abuse/tags/pd/imlib/port/unix/timing.c

Last change on this file was 49, checked in by Sam Hocevar, 11 years ago
  • Imported original public domain release, for future reference.
  • Property svn:keywords set to Id
File size: 555 bytes
Line 
1#include <stdio.h>
2#include <stdlib.h>
3#include <sys/time.h>
4#include <unistd.h>
5#include "timing.hpp"
6
7void timer_init() { ; }
8void timer_uninit() { ; }
9
10
11double time_marker::diff_time(time_marker *other)
12
13  return (double)(seconds-other->seconds)+  (double)(micro_seconds-other->micro_seconds)/1000000;
14}
15
16void time_marker::get_time()
17{
18  struct timezone tz={0,DST_USA};     
19  gettimeofday((struct timeval *)&seconds,&tz);
20}
21
22time_marker::time_marker()
23{ get_time(); }
24
25void milli_wait(unsigned wait_time)
26{
27  usleep((long)wait_time*(long)1000);
28}
29
Note: See TracBrowser for help on using the repository browser.