source: abuse/tags/pd/macabuse/imlib/port/mac/timing.c @ 49

Last change on this file since 49 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: 690 bytes
Line 
1#include "system.h"
2#include "timing.hpp"
3#include <stdio.h>
4#include <stdlib.h>
5#ifdef __MAC__
6#include <Timer.h>
7#else
8#include <sys/time.h>
9#endif
10#include <unistd.h>
11
12void timer_init() { ; }
13void timer_uninit() { ; }
14
15
16double time_marker::diff_time(time_marker *other)
17
18  return ((double)(micro_seconds - other->micro_seconds))/1000000.0;
19}
20
21void time_marker::get_time()
22{
23        UnsignedWide tm;
24       
25  Microseconds(&tm);
26  micro_seconds = tm.lo;
27}
28
29time_marker::time_marker() { get_time(); }
30
31void milli_wait(unsigned wait_time)
32{
33        UnsignedWide tim,tim2;
34       
35        Microseconds(&tim);
36        Microseconds(&tim2);
37        while ( (tim2.lo - tim.lo) < wait_time*1000)
38                Microseconds(&tim2);
39//              SystemTask();
40}
41
Note: See TracBrowser for help on using the repository browser.