iPXE
time.h
Go to the documentation of this file.
1 #ifndef _IPXE_TIME_H
2 #define _IPXE_TIME_H
3 
4 /** @file
5  *
6  * Time source
7  *
8  */
9 
10 FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
11 FILE_SECBOOT ( PERMITTED );
12 
13 #include <sys/time.h>
14 #include <ipxe/api.h>
15 #include <config/time.h>
16 
17 /**
18  * Calculate static inline time API function name
19  *
20  * @v _prefix Subsystem prefix
21  * @v _api_func API function
22  * @ret _subsys_func Subsystem API function
23  */
24 #define TIME_INLINE( _subsys, _api_func ) \
25  SINGLE_API_INLINE ( TIME_PREFIX_ ## _subsys, _api_func )
26 
27 /**
28  * Provide a time API implementation
29  *
30  * @v _prefix Subsystem prefix
31  * @v _api_func API function
32  * @v _func Implementing function
33  */
34 #define PROVIDE_TIME( _subsys, _api_func, _func ) \
35  PROVIDE_SINGLE_API ( TIME_PREFIX_ ## _subsys, _api_func, _func )
36 
37 /**
38  * Provide a static inline time API implementation
39  *
40  * @v _prefix Subsystem prefix
41  * @v _api_func API function
42  */
43 #define PROVIDE_TIME_INLINE( _subsys, _api_func ) \
44  PROVIDE_SINGLE_API_INLINE ( TIME_PREFIX_ ## _subsys, _api_func )
45 
46 /* Include all architecture-independent time API headers */
47 #include <ipxe/null_time.h>
48 #include <ipxe/efi/efi_time.h>
49 #include <ipxe/linux/linux_time.h>
50 
51 /* Include all architecture-dependent time API headers */
52 #include <bits/time.h>
53 
54 extern signed long time_offset;
55 
56 /**
57  * Get current time in seconds (ignoring system clock offset)
58  *
59  * @ret time Time, in seconds
60  */
61 time_t time_now ( void );
62 
63 /**
64  * Adjust system clock
65  *
66  * @v delta Clock adjustment, in seconds
67  */
68 static inline __attribute__ (( always_inline )) void
69 time_adjust ( signed long delta ) {
70 
71  time_offset += delta;
72 }
73 
74 #endif /* _IPXE_TIME_H */
signed long time_offset
Current system clock offset.
Definition: time.c:48
iPXE internal APIs
Date and time.
EFI time source.
time_t time_now(void)
Get current time in seconds (ignoring system clock offset)
FILE_SECBOOT(PERMITTED)
Nonexistent time source.
Linux time source.
FILE_LICENCE(GPL2_OR_LATER_OR_UBDL)
static __attribute__((always_inline)) void time_adjust(signed long delta)
Adjust system clock.
Definition: time.h:68
Time API configuration.
int64_t time_t
Seconds since the Epoch.
Definition: time.h:19