iPXE
time.h
Go to the documentation of this file.
00001 #ifndef _TIME_H
00002 #define _TIME_H
00003 
00004 /** @file
00005  *
00006  * Date and time
00007  */
00008 
00009 FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
00010 
00011 #include <sys/time.h>
00012 #include <ipxe/time.h>
00013 
00014 /** Broken-down time */
00015 struct tm {
00016         /** Seconds [0,60] */
00017         int tm_sec;
00018         /** Minutes [0,59] */
00019         int tm_min;
00020         /** Hour [0,23] */
00021         int tm_hour;
00022         /** Day of month [1,31] */
00023         int tm_mday;
00024         /** Month of year [0,11] */
00025         int tm_mon;
00026         /** Years since 1900 */
00027         int tm_year;
00028         /** Day of week [0,6] (Sunday=0) */
00029         int tm_wday;
00030         /** Day of year [0,365] */
00031         int tm_yday;
00032         /** Daylight savings flag */
00033         int tm_isdst;
00034 };
00035 
00036 /**
00037  * Get current time in seconds since the Epoch
00038  *
00039  * @v t                 Time to fill in, or NULL
00040  * @ret time            Current time
00041  */
00042 static inline __attribute__ (( always_inline )) time_t time ( time_t *t ) {
00043         time_t now;
00044 
00045         now = ( time_now() + time_offset );
00046         if ( t )
00047                 *t = now;
00048         return now;
00049 }
00050 
00051 extern time_t mktime ( struct tm *tm );
00052 
00053 #endif /* _TIME_H */