]> git.ozlabs.org Git - ccan/blob - ccan/time/_info
fdad27561a12f520ae5d3d4d92d4680d2fa9e89d
[ccan] / ccan / time / _info
1 #include <string.h>
2 #include "config.h"
3
4 /**
5  * time - routines for dealing with time
6  *
7  * This code provides convenient functions for working with time.
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 timeval 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.%06u\n",
32  *                     (unsigned long)t.tv_sec, (unsigned)t.tv_usec);
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
42         if (strcmp(argv[1], "depends") == 0) {
43                 return 0;
44         }
45
46         return 1;
47 }