|  | @@ -82,6 +82,23 @@
 | 
	
		
			
				|  |  |  #include <fcntl.h>
 | 
	
		
			
				|  |  |  #endif /* !_WIN32_WCE */
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +#ifdef __MACH__
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +#define CLOCK_REALTIME 0
 | 
	
		
			
				|  |  | +#define CLOCK_MONOTONIC 0
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +#include <sys/time.h>
 | 
	
		
			
				|  |  | +//clock_gettime is not implemented on OSX
 | 
	
		
			
				|  |  | +int clock_gettime(int clk_id, struct timespec* t) {
 | 
	
		
			
				|  |  | +    struct timeval now;
 | 
	
		
			
				|  |  | +    int rv = gettimeofday(&now, NULL);
 | 
	
		
			
				|  |  | +    if (rv) return rv;
 | 
	
		
			
				|  |  | +    t->tv_sec  = now.tv_sec;
 | 
	
		
			
				|  |  | +    t->tv_nsec = now.tv_usec * 1000;
 | 
	
		
			
				|  |  | +    return 0;
 | 
	
		
			
				|  |  | +}
 | 
	
		
			
				|  |  | +#endif
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |  #include <time.h>
 | 
	
		
			
				|  |  |  #include <stdlib.h>
 | 
	
		
			
				|  |  |  #include <stdarg.h>
 |