riot_time.c 700 B

12345678910111213141516171819202122232425262728293031323334
  1. /*
  2. * Copyright (C) 2019 Intel Corporation. All rights reserved.
  3. * Copyright (C) 2020 TU Bergakademie Freiberg Karl Fessel
  4. * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  5. */
  6. #include "platform_api_vmcore.h"
  7. #include <ztimer64.h>
  8. #include <kernel_defines.h>
  9. #if IS_USED(MODULE_ZTIMER64_USEC)
  10. uint64
  11. os_time_get_boot_microsecond()
  12. {
  13. return ztimer64_now(ZTIMER64_USEC);
  14. }
  15. #elif IS_USED(MODULE_ZTIMER64_MSEC)
  16. uint64
  17. os_time_get_boot_microsecond()
  18. {
  19. return ztimer64_now(ZTIMER64_MSEC) * 1000;
  20. }
  21. #else
  22. #ifdef __GNUC__
  23. __attribute__((weak)) uint64
  24. os_time_get_boot_microsecond();
  25. #endif
  26. uint64
  27. os_time_get_boot_microsecond()
  28. {
  29. static uint64_t times;
  30. return ++times;
  31. }
  32. #endif