_info 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. #include <string.h>
  2. #include "config.h"
  3. /**
  4. * time - routines for dealing with time
  5. *
  6. * This code provides convenient functions for working with time.
  7. *
  8. * Author: Rusty Russell <rusty@rustcorp.com.au>
  9. * License: BSD-MIT
  10. *
  11. * Example:
  12. * #include <ccan/time/time.h>
  13. * #include <stdlib.h>
  14. * #include <stdio.h>
  15. * #include <err.h>
  16. *
  17. * int main(int argc, char *argv[])
  18. * {
  19. * struct timespec t;
  20. *
  21. * if (argc != 2)
  22. * errx(1, "Usage: %s <diff in millisec>", argv[0]);
  23. *
  24. * t = time_now();
  25. * if (argv[1][0] == '-')
  26. * t = time_sub(t, time_from_msec(atol(argv[1]+1)));
  27. * else
  28. * t = time_add(t, time_from_msec(atol(argv[1])));
  29. *
  30. * printf("%lu.%09u\n",
  31. * (unsigned long)t.tv_sec, (unsigned)t.tv_nsec);
  32. * return 0;
  33. * }
  34. */
  35. int main(int argc, char *argv[])
  36. {
  37. /* Expect exactly one argument */
  38. if (argc != 2)
  39. return 1;
  40. if (strcmp(argv[1], "depends") == 0) {
  41. return 0;
  42. }
  43. #if HAVE_CLOCK_GETTIME_IN_LIBRT
  44. if (strcmp(argv[1], "libs") == 0) {
  45. printf("rt\n");
  46. return 0;
  47. }
  48. #endif
  49. return 1;
  50. }