[time] Define an API for getting the current time
Signed-off-by: Michael Brown <mcb30@ipxe.org>
This commit is contained in:
@@ -7,6 +7,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/time.h>
|
||||
#include <ipxe/time.h>
|
||||
|
||||
/** Broken-down time */
|
||||
struct tm {
|
||||
@@ -30,6 +31,21 @@ struct tm {
|
||||
int tm_isdst;
|
||||
};
|
||||
|
||||
/**
|
||||
* Get current time in seconds since the Epoch
|
||||
*
|
||||
* @v t Time to fill in, or NULL
|
||||
* @ret time Current time
|
||||
*/
|
||||
static inline time_t time ( time_t *t ) {
|
||||
time_t now;
|
||||
|
||||
now = time_now();
|
||||
if ( t )
|
||||
*t = now;
|
||||
return now;
|
||||
}
|
||||
|
||||
extern time_t mktime ( struct tm *tm );
|
||||
|
||||
#endif /* _TIME_H */
|
||||
|
||||
Reference in New Issue
Block a user