logo

oasis

Own branch of Oasis Linux (upstream: <https://git.sr.ht/~mcf/oasis/>) git clone https://anongit.hacktivis.me/git/oasis.git

0001-tain_now-Use-clock_gettime.patch (840B)


  1. From dc52122121b078efbfc914ab256848cc0007c14e Mon Sep 17 00:00:00 2001
  2. From: Michael Forney <mforney@mforney.org>
  3. Date: Sun, 26 Mar 2017 17:12:30 -0700
  4. Subject: [PATCH] tain_now: Use clock_gettime
  5. ---
  6. lasagna/tain/tain_now.c | 7 +++----
  7. 1 file changed, 3 insertions(+), 4 deletions(-)
  8. diff --git a/lasagna/tain/tain_now.c b/lasagna/tain/tain_now.c
  9. index 3c790be..ba53864 100644
  10. --- a/lasagna/tain/tain_now.c
  11. +++ b/lasagna/tain/tain_now.c
  12. @@ -6,18 +6,17 @@
  13. #include <stdlib.h>
  14. #include <time.h>
  15. -#include <sys/time.h>
  16. #include "tain.h"
  17. struct tain *
  18. tain_now(struct tain *t)
  19. {
  20. - struct timeval now;
  21. + struct timespec now;
  22. - gettimeofday(&now, NULL);
  23. + clock_gettime(CLOCK_REALTIME, &now);
  24. tain_load_utc(t, now.tv_sec);
  25. - t->nsec = (1000 * now.tv_usec) + 500;
  26. + t->nsec = now.tv_nsec;
  27. return t;
  28. }
  29. --
  30. 2.12.1