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
10FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
11FILE_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>
50
51/* Include all architecture-dependent time API headers */
52#include <bits/time.h>
53
54extern signed long time_offset;
55
56/**
57 * Get current time in seconds (ignoring system clock offset)
58 *
59 * @ret time Time, in seconds
60 */
62
63/**
64 * Adjust system clock
65 *
66 * @v delta Clock adjustment, in seconds
67 */
68static inline __attribute__ (( always_inline )) void
69time_adjust ( signed long delta ) {
70
71 time_offset += delta;
72}
73
74#endif /* _IPXE_TIME_H */
iPXE internal APIs
x86-specific time API implementations
Time API configuration.
EFI time source.
#define FILE_LICENCE(_licence)
Declare a particular licence as applying to a file.
Definition compiler.h:896
#define FILE_SECBOOT(_status)
Declare a file's UEFI Secure Boot permission status.
Definition compiler.h:926
#define __attribute__(x)
Definition compiler.h:10
time_t time_now(void)
Get current time in seconds (ignoring system clock offset)
Date and time.
int64_t time_t
Seconds since the Epoch.
Definition time.h:19
Linux time source.
Nonexistent time source.
signed long time_offset
Current system clock offset.
Definition time.c:48