You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

time.h 1.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. #ifndef _IPXE_TIME_H
  2. #define _IPXE_TIME_H
  3. /** @file
  4. *
  5. * Time source
  6. *
  7. */
  8. FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
  9. #include <sys/time.h>
  10. #include <ipxe/api.h>
  11. #include <config/time.h>
  12. /**
  13. * Calculate static inline time API function name
  14. *
  15. * @v _prefix Subsystem prefix
  16. * @v _api_func API function
  17. * @ret _subsys_func Subsystem API function
  18. */
  19. #define TIME_INLINE( _subsys, _api_func ) \
  20. SINGLE_API_INLINE ( TIME_PREFIX_ ## _subsys, _api_func )
  21. /**
  22. * Provide a time API implementation
  23. *
  24. * @v _prefix Subsystem prefix
  25. * @v _api_func API function
  26. * @v _func Implementing function
  27. */
  28. #define PROVIDE_TIME( _subsys, _api_func, _func ) \
  29. PROVIDE_SINGLE_API ( TIME_PREFIX_ ## _subsys, _api_func, _func )
  30. /**
  31. * Provide a static inline time API implementation
  32. *
  33. * @v _prefix Subsystem prefix
  34. * @v _api_func API function
  35. */
  36. #define PROVIDE_TIME_INLINE( _subsys, _api_func ) \
  37. PROVIDE_SINGLE_API_INLINE ( TIME_PREFIX_ ## _subsys, _api_func )
  38. /* Include all architecture-independent time API headers */
  39. #include <ipxe/null_time.h>
  40. #include <ipxe/efi/efi_time.h>
  41. #include <ipxe/linux/linux_time.h>
  42. /* Include all architecture-dependent time API headers */
  43. #include <bits/time.h>
  44. /**
  45. * Get current time in seconds
  46. *
  47. * @ret time Time, in seconds
  48. */
  49. time_t time_now ( void );
  50. #endif /* _IPXE_TIME_H */