 e67fc5771d
			
		
	
	
		e67fc5771d
		
	
	
	
	
		
			
			In order to make it more clear that ticks should be used for timers and realtime should be used for timestamps / displaying the date/time, getuptime() was renamed to getticks() and getuptime2() was renamed to getuptime(). Servers, drivers, libraries, tests, etc that use getuptime()/getuptime2() have been updated. In instances where a realtime was calculated, the calculation was changed to use realtime. System calls clock_getres() and clock_gettime() were added to PM/libc.
		
			
				
	
	
		
			29 lines
		
	
	
		
			412 B
		
	
	
	
		
			C
		
	
	
	
	
	
			
		
		
	
	
			29 lines
		
	
	
		
			412 B
		
	
	
	
		
			C
		
	
	
	
	
	
| #include <sys/types.h>
 | |
| #include <minix/sysutil.h>
 | |
| #include <errno.h>
 | |
| 
 | |
| u32_t sys_jiffies(void)
 | |
| {
 | |
| 	clock_t ticks;
 | |
| 
 | |
| 	if (getticks(&ticks) == OK)
 | |
| 		return  ticks;
 | |
| 	else
 | |
| 		panic("getuptime() failed\n");
 | |
| }
 | |
| 
 | |
| u32_t sys_now(void)
 | |
| {
 | |
| 	static u32_t hz;
 | |
| 	u32_t jiffs;
 | |
| 
 | |
| 	if (!hz)
 | |
| 		hz = sys_hz();
 | |
| 
 | |
| 	/* use ticks not realtime as sys_now() is used to calculate timers */
 | |
| 	jiffs = sys_jiffies();
 | |
| 
 | |
| 	return jiffs * (1000 / hz);
 | |
| }
 | |
| 
 |