7 #include "cln/timing.h"
12 #include "cl_t_config.h"
15 #if defined(HAVE_GETTIMEOFDAY)
17 #ifdef GETTIMEOFDAY_DOTS
18 extern "C" int gettimeofday (struct timeval * tp, ...);
20 extern "C" int gettimeofday (struct timeval * tp, GETTIMEOFDAY_TZP_T tzp);
25 #ifdef HAVE_PERROR_DECL
29 extern "C" int perror (const char *);
34 const cl_timespec cl_current_time ()
36 #if defined(HAVE_GETTIMEOFDAY)
37 var struct timeval tv;
38 if (gettimeofday(&tv,NULL) != 0) {
39 perror("gettimeofday");
40 tv.tv_sec = 0; tv.tv_usec = 0;
42 return cl_timespec(tv.tv_sec,
43 tv.tv_usec * (1000000000/1000000)
46 return cl_timespec(time(NULL),0);