time.c 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  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
  11. ocall_clock_gettime(unsigned clock_id, void *tp_buf, unsigned int tp_buf_size)
  12. {
  13. return clock_gettime((clockid_t)clock_id, (struct timespec *)tp_buf);
  14. }
  15. int
  16. ocall_clock_getres(int clock_id, void *res_buf, unsigned int res_buf_size)
  17. {
  18. return clock_getres(clock_id, (struct timespec *)res_buf);
  19. }
  20. int
  21. ocall_utimensat(int dirfd, const char *pathname, const void *times_buf,
  22. unsigned int times_buf_size, int flags)
  23. {
  24. return utimensat(dirfd, pathname, (struct timespec *)times_buf, flags);
  25. }
  26. int
  27. ocall_futimens(int fd, const void *times_buf, unsigned int times_buf_size)
  28. {
  29. return futimens(fd, (struct timespec *)times_buf);
  30. }
  31. int
  32. ocall_clock_nanosleep(unsigned clock_id, int flags, const void *req_buf,
  33. unsigned int req_buf_size, const void *rem_buf,
  34. 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. }