source: abuse/branches/pd/imlib/port/mac/timing.c @ 528

Last change on this file since 528 was 49, checked in by Sam Hocevar, 15 years ago
  • Imported original public domain release, for future reference.
  • Property svn:keywords set to Id
File size: 779 bytes
Line 
1#include <stdio.h>
2#include <stdlib.h>
3#ifdef __POWERPC__
4#include <time.h>
5#else
6#include <sys/time.h>
7#endif
8#include <unistd.h>
9#include "timing.hpp"
10
11void timer_init() { ; }
12void timer_uninit() { ; }
13
14
15double time_marker::diff_time(time_marker *other)
16
17  return (double)(seconds-other->seconds)+  (double)(micro_seconds-other->micro_seconds)/1000000;
18}
19
20void time_marker::get_time()
21{
22  micro_seconds = clock();
23  seconds = micro_seconds/CLOCKS_PER_SEC;
24  micro_seconds = (micro_seconds%CLOCKS_PER_SEC)*1000000/CLOCKS_PER_SEC;
25}
26
27time_marker::time_marker() { get_time(); }
28
29void milli_wait(unsigned wait_time)
30{
31        clock_t tim;
32       
33        tim = clock();
34        tim += (clock_t)(wait_time*CLOCKS_PER_SEC/1000);
35        while ( (signed long)tim - (signed long)clock() > 0 ) ;
36//              SystemTask();
37}
38
Note: See TracBrowser for help on using the repository browser.