You can not select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
		
		
			
		
			
				
					
					
						
							16 lines
						
					
					
						
							386 B
						
					
					
				
			
		
		
	
	
							16 lines
						
					
					
						
							386 B
						
					
					
				from posix.time cimport clock_gettime, timespec, CLOCK_BOOTTIME, CLOCK_MONOTONIC_RAW
 | 
						|
 | 
						|
cdef double readclock(int clock_id):
 | 
						|
  cdef timespec ts
 | 
						|
  cdef double current
 | 
						|
 | 
						|
  clock_gettime(clock_id, &ts)
 | 
						|
  current = ts.tv_sec + (ts.tv_nsec / 1000000000.)
 | 
						|
  return current
 | 
						|
 | 
						|
 | 
						|
def monotonic_time():
 | 
						|
  return readclock(CLOCK_MONOTONIC_RAW)
 | 
						|
 | 
						|
def sec_since_boot():
 | 
						|
  return readclock(CLOCK_BOOTTIME)
 | 
						|
 |