Convert another parser of struct timespec to new mpers infrastructure

* print_time.c (sprint_timespec): New mpers printer.
* defs.h (TIMESPEC_TEXT_BUFSIZE): Update.
(sprint_timespec): Remove.
* time.c (sprint_timespec): Remove.
* net.c (sys_recvmmsg): Update callers.
* poll.c (decode_poll_exiting): Likewise.
diff --git a/defs.h b/defs.h
index 826ab94..9b9a105 100644
--- a/defs.h
+++ b/defs.h
@@ -647,11 +647,11 @@
 	ATTRIBUTE_FORMAT((printf, 3, 0));
 extern void printpath(struct tcb *, long);
 extern void printpathn(struct tcb *, long, unsigned int);
-#define TIMESPEC_TEXT_BUFSIZE (sizeof(long)*3 * 2 + sizeof("{%u, %u}"))
+#define TIMESPEC_TEXT_BUFSIZE \
+		(sizeof(intmax_t)*3 * 2 + sizeof("{tv_sec=%jd, tv_nsec=%jd}"))
 #define TIMEVAL_TEXT_BUFSIZE  TIMESPEC_TEXT_BUFSIZE
 extern void printtv_bitness(struct tcb *, long, enum bitness_t, int);
 extern char *sprinttv(char *, struct tcb *, long, enum bitness_t, int special);
-extern void sprint_timespec(char *, struct tcb *, long);
 extern void printfd(struct tcb *, int);
 extern bool print_sockaddr_by_inode(const unsigned long, const char *);
 extern void print_dirfd(struct tcb *, int);
diff --git a/net.c b/net.c
index 40b5a5c..7e8586a 100644
--- a/net.c
+++ b/net.c
@@ -875,18 +875,16 @@
 
 SYS_FUNC(recvmmsg)
 {
-	/* +5 chars are for "left " prefix */
-	static char str[5 + TIMESPEC_TEXT_BUFSIZE];
+	static char str[sizeof("left") + TIMESPEC_TEXT_BUFSIZE];
 
 	if (entering(tcp)) {
 		printfd(tcp, tcp->u_arg[0]);
 		tprints(", ");
 		if (verbose(tcp)) {
-			sprint_timespec(str, tcp, tcp->u_arg[4]);
 			/* Abusing tcp->auxstr as temp storage.
-			 * Will be used and freed on syscall exit.
+			 * Will be used and cleared on syscall exit.
 			 */
-			tcp->auxstr = xstrdup(str);
+			tcp->auxstr = sprint_timespec(tcp, tcp->u_arg[4]);
 		} else {
 			tprintf("%#lx, %ld, ", tcp->u_arg[1], tcp->u_arg[2]);
 			printflags(msg_flags, tcp->u_arg[3], "MSG_???");
@@ -897,9 +895,9 @@
 	} else {
 		if (verbose(tcp)) {
 			decode_mmsg(tcp, 0);
+			tprints(", ");
 			/* timeout on entrance */
-			tprintf(", %s", tcp->auxstr ? tcp->auxstr : "{...}");
-			free((void *) tcp->auxstr);
+			tprints(tcp->auxstr);
 			tcp->auxstr = NULL;
 		}
 		if (syserror(tcp))
@@ -911,7 +909,8 @@
 		if (!verbose(tcp))
 			return 0;
 		/* timeout on exit */
-		sprint_timespec(stpcpy(str, "left "), tcp, tcp->u_arg[4]);
+		snprintf(str, sizeof(str), "left %s",
+			 sprint_timespec(tcp, tcp->u_arg[4]));
 		tcp->auxstr = str;
 		return RVAL_STR;
 	}
diff --git a/poll.c b/poll.c
index bf9707c..4c3f19e 100644
--- a/poll.c
+++ b/poll.c
@@ -169,12 +169,11 @@
 
 	*outptr = '\0';
 	if (pts) {
-		char tmbuf[TIMESPEC_TEXT_BUFSIZE];
+		const char *str = sprint_timespec(tcp, pts);
 
-		sprint_timespec(tmbuf, tcp, pts);
-		if (outptr + sizeof(", left ") + strlen(tmbuf) < end_outstr) {
+		if (outptr + sizeof(", left ") + strlen(str) < end_outstr) {
 			outptr = stpcpy(outptr, outptr == outstr ? "left " : ", left ");
-			outptr = stpcpy(outptr, tmbuf);
+			outptr = stpcpy(outptr, str);
 		} else {
 			outptr = stpcpy(outptr, ", ...");
 		}
diff --git a/print_time.c b/print_time.c
index 1476519..1e6aa76 100644
--- a/print_time.c
+++ b/print_time.c
@@ -56,6 +56,24 @@
 	print_timespec_t(&t);
 }
 
+MPERS_PRINTER_DECL(const char *, sprint_timespec)(struct tcb *tcp, const long addr)
+{
+	timespec_t t;
+	static char buf[sizeof(time_fmt) + 3 * sizeof(t)];
+
+	if (!addr) {
+		strcpy(buf, "NULL");
+	} else if (!verbose(tcp) || (exiting(tcp) && syserror(tcp)) ||
+		   umove(tcp, addr, &t)) {
+		snprintf(buf, sizeof(buf), "%#lx", addr);
+	} else {
+		snprintf(buf, sizeof(buf), time_fmt,
+			 (intmax_t) t.tv_sec, (intmax_t) t.tv_nsec);
+	}
+
+	return buf;
+}
+
 MPERS_PRINTER_DECL(void, print_timespec_utime_pair)(struct tcb *tcp, const long addr)
 {
 	timespec_t t[2];
diff --git a/time.c b/time.c
index 209cb87..9a95525 100644
--- a/time.c
+++ b/time.c
@@ -102,40 +102,6 @@
 	return buf + sprintf(buf, "%#lx", addr);
 }
 
-void
-sprint_timespec(char *buf, struct tcb *tcp, long addr)
-{
-	if (addr == 0)
-		strcpy(buf, "NULL");
-	else if (!verbose(tcp))
-		sprintf(buf, "%#lx", addr);
-	else {
-		int rc;
-
-#if SUPPORTED_PERSONALITIES > 1
-		if (current_time_t_is_compat) {
-			struct timeval32 tv;
-
-			rc = umove(tcp, addr, &tv);
-			if (rc >= 0)
-				sprintf(buf, "{%u, %u}",
-					tv.tv_sec, tv.tv_usec);
-		} else
-#endif
-		{
-			struct timespec ts;
-
-			rc = umove(tcp, addr, &ts);
-			if (rc >= 0)
-				sprintf(buf, "{%ju, %ju}",
-					(uintmax_t) ts.tv_sec,
-					(uintmax_t) ts.tv_nsec);
-		}
-		if (rc < 0)
-			strcpy(buf, "{...}");
-	}
-}
-
 static void
 print_timezone(struct tcb *tcp, const long addr)
 {