time.c 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. /*
  2. * Copyright (C) 2019 Intel Corporation. All rights reserved.
  3. * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  4. */
  5. #include <stdbool.h>
  6. #include <sys/stat.h>
  7. #include <time.h>
  8. #include <fcntl.h>
  9. /** time clock **/
  10. int ocall_clock_gettime(unsigned clock_id, void *tp_buf,
  11. unsigned int tp_buf_size)
  12. {
  13. return clock_gettime((clockid_t)clock_id,
  14. (struct timespec *)tp_buf);
  15. }
  16. int ocall_clock_getres(int clock_id, void *res_buf,
  17. unsigned int res_buf_size)
  18. {
  19. return clock_getres(clock_id, (struct timespec *)res_buf);
  20. }
  21. int ocall_utimensat(int dirfd, const char *pathname,
  22. const void *times_buf,
  23. unsigned int times_buf_size, int flags)
  24. {
  25. return utimensat(dirfd, pathname, (struct timespec *)times_buf, flags);
  26. }
  27. int ocall_futimens(int fd, const void *times_buf,
  28. unsigned int times_buf_size)
  29. {
  30. return futimens(fd, (struct timespec *)times_buf);
  31. }
  32. int ocall_clock_nanosleep(unsigned clock_id, int flags,
  33. const void *req_buf, unsigned int req_buf_size,
  34. const void *rem_buf, unsigned int rem_buf_size)
  35. {
  36. return clock_nanosleep((clockid_t)clock_id, flags,
  37. (struct timespec *)req_buf,
  38. (struct timespec *)rem_buf);
  39. }