introduce a helper function to print out a timeval
parent
ecb57f8f04
commit
51d5bfc8d5
|
@ -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();
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue