iPXE
time.h
Go to the documentation of this file.
1#ifndef _TIME_H
2#define _TIME_H
3
4/** @file
5 *
6 * Date and time
7 */
8
9FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
10FILE_SECBOOT ( PERMITTED );
11
12#include <sys/time.h>
13#include <ipxe/time.h>
14
15/** Broken-down time */
16struct tm {
17 /** Seconds [0,60] */
18 int tm_sec;
19 /** Minutes [0,59] */
20 int tm_min;
21 /** Hour [0,23] */
23 /** Day of month [1,31] */
25 /** Month of year [0,11] */
26 int tm_mon;
27 /** Years since 1900 */
29 /** Day of week [0,6] (Sunday=0) */
31 /** Day of year [0,365] */
33 /** Daylight savings flag */
35};
36
37/**
38 * Get current time in seconds since the Epoch
39 *
40 * @v t Time to fill in, or NULL
41 * @ret time Current time
42 */
43static inline __attribute__ (( always_inline )) time_t time ( time_t *t ) {
44 time_t now;
45
46 now = ( time_now() + time_offset );
47 if ( t )
48 *t = now;
49 return now;
50}
51
52extern time_t mktime ( struct tm *tm );
53
54#endif /* _TIME_H */
#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 source.
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
time_t mktime(struct tm *tm)
Calculate seconds since the Epoch.
Definition time.c:118
Broken-down time.
Definition time.h:16
int tm_mon
Month of year [0,11].
Definition time.h:26
int tm_year
Years since 1900.
Definition time.h:28
int tm_hour
Hour [0,23].
Definition time.h:22
int tm_sec
Seconds [0,60].
Definition time.h:18
int tm_isdst
Daylight savings flag.
Definition time.h:34
int tm_yday
Day of year [0,365].
Definition time.h:32
int tm_mday
Day of month [1,31].
Definition time.h:24
int tm_min
Minutes [0,59].
Definition time.h:20
int tm_wday
Day of week [0,6] (Sunday=0)
Definition time.h:30
signed long time_offset
Current system clock offset.
Definition time.c:48