diff options
Diffstat (limited to 'tools')
-rw-r--r-- | tools/virsh-domain.c | 6 | ||||
-rw-r--r-- | tools/virsh.c | 6 |
2 files changed, 6 insertions, 6 deletions
diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c index f0ec742aa..3cef7824b 100644 --- a/tools/virsh-domain.c +++ b/tools/virsh-domain.c @@ -3707,7 +3707,7 @@ static char * vshGenFileName(vshControl *ctl, virDomainPtr dom, const char *mime) { char timestr[100]; - struct timeval cur_time; + time_t cur_time; struct tm time_info; const char *ext = NULL; char *ret = NULL; @@ -3723,8 +3723,8 @@ vshGenFileName(vshControl *ctl, virDomainPtr dom, const char *mime) ext = ".png"; /* add mime type here */ - gettimeofday(&cur_time, NULL); - localtime_r(&cur_time.tv_sec, &time_info); + time (&cur_time); + localtime_r(&cur_time, &time_info); strftime(timestr, sizeof(timestr), "%Y-%m-%d-%H:%M:%S", &time_info); if (virAsprintf(&ret, "%s-%s%s", virDomainGetName(dom), diff --git a/tools/virsh.c b/tools/virsh.c index 5cf3237dd..88da4297b 100644 --- a/tools/virsh.c +++ b/tools/virsh.c @@ -2187,7 +2187,7 @@ vshOutputLogFile(vshControl *ctl, int log_level, const char *msg_format, char *str; size_t len; const char *lvl = ""; - struct timeval stTimeval; + time_t stTime; struct tm *stTm; if (ctl->log_fd == -1) @@ -2198,8 +2198,8 @@ vshOutputLogFile(vshControl *ctl, int log_level, const char *msg_format, * * [YYYY.MM.DD HH:MM:SS SIGNATURE PID] LOG_LEVEL message */ - gettimeofday(&stTimeval, NULL); - stTm = localtime(&stTimeval.tv_sec); + time (&stTime); + stTm = localtime(&stTime); virBufferAsprintf(&buf, "[%d.%02d.%02d %02d:%02d:%02d %s %d] ", (1900 + stTm->tm_year), (1 + stTm->tm_mon), |