2 * UCW Library -- A Simple Millisecond Timer
4 * (c) 2007--2012 Martin Mares <mj@ucw.cz>
6 * This software may be freely distributed and used according to the terms
7 * of the GNU Lesser General Public License.
16 #ifdef CONFIG_UCW_MONOTONIC_CLOCK
22 if (clock_gettime(CLOCK_MONOTONIC, &ts) < 0)
23 die("clock_gettime failed: %m");
24 return (timestamp_t)ts.tv_sec * 1000 + ts.tv_nsec / 1000000;
33 gettimeofday(&tv, NULL);
34 return (timestamp_t)tv.tv_sec * 1000 + tv.tv_usec / 1000
35 #ifdef CONFIG_UCW_DEBUG
36 + 3141592653 // So that we catch all attempts to corelate timestamp_t with wall clock
49 printf("%ju\n", (intmax_t) get_timestamp());