mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-28 11:02:36 +00:00 
			
		
		
		
	 b7dae4f90e
			
		
	
	
		b7dae4f90e
		
	
	
	
	
		
			
			This allows clock_gettime(CLOCK_MONOTONIC_COARSE) without syscalls. Core::EventLoop takes advantage of this automatically. :^)
		
			
				
	
	
		
			30 lines
		
	
	
	
		
			513 B
		
	
	
	
		
			C++
		
	
	
	
	
	
			
		
		
	
	
			30 lines
		
	
	
	
		
			513 B
		
	
	
	
		
			C++
		
	
	
	
	
	
| /*
 | |
|  * Copyright (c) 2021, Andreas Kling <kling@serenityos.org>
 | |
|  *
 | |
|  * SPDX-License-Identifier: BSD-2-Clause
 | |
|  */
 | |
| 
 | |
| #pragma once
 | |
| 
 | |
| #include <AK/Types.h>
 | |
| 
 | |
| #ifdef KERNEL
 | |
| #    include <Kernel/UnixTypes.h>
 | |
| #else
 | |
| #    include <time.h>
 | |
| #endif
 | |
| 
 | |
| namespace Kernel {
 | |
| 
 | |
| inline bool time_page_supports(clockid_t clock_id)
 | |
| {
 | |
|     return clock_id == CLOCK_REALTIME_COARSE || clock_id == CLOCK_MONOTONIC_COARSE;
 | |
| }
 | |
| 
 | |
| struct TimePage {
 | |
|     volatile u32 update1;
 | |
|     struct timespec clocks[CLOCK_ID_COUNT];
 | |
|     volatile u32 update2;
 | |
| };
 | |
| 
 | |
| }
 |