diff options
author | Michael Brown <mcb30@ipxe.org> | 2012-03-19 16:59:53 +0000 |
---|---|---|
committer | Michael Brown <mcb30@ipxe.org> | 2012-03-19 22:13:27 +0000 |
commit | 846bde90e6b1001480016fa46a957a9e726af68a (patch) | |
tree | cf3dfaaef4c90864c11c707482fde92f49b4abf7 /src/include/time.h | |
parent | c130001bdfb2fa4c880b59f76340a91703ffcfc9 (diff) | |
download | ipxe-846bde90e6b1001480016fa46a957a9e726af68a.tar.gz |
[time] Define an API for getting the current time
Signed-off-by: Michael Brown <mcb30@ipxe.org>
Diffstat (limited to 'src/include/time.h')
-rw-r--r-- | src/include/time.h | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/include/time.h b/src/include/time.h index f33300ab3..bc73af4cd 100644 --- a/src/include/time.h +++ b/src/include/time.h @@ -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 */ |