mirror of
https://github.com/ipxe/ipxe
synced 2026-01-27 01:53:22 +03:00
[time] Use currticks() to provide the null system time
For platforms with no real-time clock (such as RISC-V SBI) we use the null time source, which currently just returns a constant zero. Switch to using currticks() to provide a clock that does not represent the real current time, but does at least advance at approximately the correct rate. In conjunction with the "ntp" command, this allows these platforms to use time-dependent features such as X.509 certificate verification for HTTPS connections. Signed-off-by: Michael Brown <mcb30@ipxe.org>
This commit is contained in:
@@ -30,5 +30,17 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
|
||||
*/
|
||||
|
||||
#include <ipxe/time.h>
|
||||
#include <ipxe/timer.h>
|
||||
|
||||
PROVIDE_TIME_INLINE ( null, time_now );
|
||||
/**
|
||||
* Get current time in seconds
|
||||
*
|
||||
* @ret time Time, in seconds
|
||||
*/
|
||||
static time_t null_now ( void ) {
|
||||
|
||||
/* Provide a non-absolute timer bassed on currticks() */
|
||||
return ( currticks() / TICKS_PER_SEC );
|
||||
}
|
||||
|
||||
PROVIDE_TIME ( null, time_now, null_now );
|
||||
|
||||
@@ -15,9 +15,4 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
|
||||
#define TIME_PREFIX_null __null_
|
||||
#endif
|
||||
|
||||
static inline __always_inline time_t
|
||||
TIME_INLINE ( null, time_now ) ( void ) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif /* _IPXE_NULL_TIME_H */
|
||||
|
||||
Reference in New Issue
Block a user