_info 1.0 KB

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