introduce a helper function to print out a timeval

pull/1857/head
Isaac Connor 2017-04-12 13:40:38 -04:00
parent ecb57f8f04
commit 51d5bfc8d5
2 changed files with 13 additions and 0 deletions

View File

@ -390,6 +390,18 @@ void timespec_diff(struct timespec *start, struct timespec *end, struct timespec
}
}
char *timeval_to_string( struct timeval tv ) {
time_t nowtime;
struct tm *nowtm;
char tmbuf[64], buf[64];
nowtime = tv.tv_sec;
nowtm = localtime(&nowtime);
strftime(tmbuf, sizeof tmbuf, "%Y-%m-%d %H:%M:%S", nowtm);
snprintf(buf, sizeof buf, "%s.%06ld", tmbuf, tv.tv_usec);
return buf;
}
std::string UriDecode( const std::string &encoded ) {
#ifdef HAVE_LIBCURL
CURL *curl = curl_easy_init();

View File

@ -61,6 +61,7 @@ void hwcaps_detect();
extern unsigned int sseversion;
extern unsigned int neonversion;
char *timeval_to_string( struct timeval tv );
std::string UriDecode( const std::string &encoded );
#endif // ZM_UTILS_H