[time] Define an API for getting the current time

Signed-off-by: Michael Brown <mcb30@ipxe.org>
This commit is contained in:
Michael Brown
2012-03-19 22:13:27 +00:00
parent c130001bdf
commit 846bde90e6
10 changed files with 169 additions and 0 deletions
+16
View File
@@ -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 */