From b1a01b8d42555979255977eb7dfc5db5cef0d769 Mon Sep 17 00:00:00 2001 From: "Dmitry V. Levin" Date: Sat, 6 Dec 2014 03:53:16 +0000 Subject: [PATCH] Export sprinttime * defs.h (sprinttime): New prototype. * file.c (sprinttime): Make global and move to util.c. --- defs.h | 1 + file.c | 21 --------------------- util.c | 21 +++++++++++++++++++++ 3 files changed, 22 insertions(+), 21 deletions(-) diff --git a/defs.h b/defs.h index bcdf6253..164842aa 100644 --- a/defs.h +++ b/defs.h @@ -673,6 +673,7 @@ extern void addflags(const struct xlat *, int); extern int printflags(const struct xlat *, int, const char *); extern const char *sprintflags(const char *, const struct xlat *, int); extern const char *sprintmode(int); +extern const char *sprinttime(time_t); extern void dumpiov_in_msghdr(struct tcb *, long); extern void dumpiov_in_mmsghdr(struct tcb *, long); extern void dumpiov(struct tcb *, int, long); diff --git a/file.c b/file.c index 7dfe0a69..af091890 100644 --- a/file.c +++ b/file.c @@ -506,27 +506,6 @@ sys_ftruncate64(struct tcb *tcp) /* several stats */ -static char * -sprinttime(time_t t) -{ - struct tm *tmp; - static char buf[sizeof("yyyy/mm/dd-hh:mm:ss")]; - - if (t == 0) { - strcpy(buf, "0"); - return buf; - } - tmp = localtime(&t); - if (tmp) - snprintf(buf, sizeof buf, "%02d/%02d/%02d-%02d:%02d:%02d", - tmp->tm_year + 1900, tmp->tm_mon + 1, tmp->tm_mday, - tmp->tm_hour, tmp->tm_min, tmp->tm_sec); - else - snprintf(buf, sizeof buf, "%lu", (unsigned long) t); - - return buf; -} - #if defined(SPARC) || defined(SPARC64) typedef struct { int tv_sec; diff --git a/util.c b/util.c index cd4b8022..71e921d0 100644 --- a/util.c +++ b/util.c @@ -421,6 +421,27 @@ printnum_int(struct tcb *tcp, long addr, const char *fmt) tprints("]"); } +const char * +sprinttime(time_t t) +{ + struct tm *tmp; + static char buf[sizeof("yyyy/mm/dd-hh:mm:ss")]; + + if (t == 0) { + strcpy(buf, "0"); + return buf; + } + tmp = localtime(&t); + if (tmp) + snprintf(buf, sizeof buf, "%02d/%02d/%02d-%02d:%02d:%02d", + tmp->tm_year + 1900, tmp->tm_mon + 1, tmp->tm_mday, + tmp->tm_hour, tmp->tm_min, tmp->tm_sec); + else + snprintf(buf, sizeof buf, "%lu", (unsigned long) t); + + return buf; +} + static char * getfdproto(struct tcb *tcp, int fd, char *buf, unsigned bufsize) { -- 2.34.1