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