Subject: [patch] Missing cast when printing time_t
From: Matthew Martin <[email-masked]>
To: [email-masked]
Date: Wed, 18 May 2016 21:51:46 -0500
List-Id: Zsh Workers List <zsh-workers.zsh.org>

When compiling on OpenBSD, clang points out that a time_t is printed as
a long while it's a long long. H/t jca for pointing out PRINTF_HAS_LLD.

- Matthew Martin

diff --git a/Src/Builtins/sched.c b/Src/Builtins/sched.c
index 70625ed..835e72c 100644
--- a/Src/Builtins/sched.c
+++ b/Src/Builtins/sched.c
@@ -353,7 +353,11 @@ schedgetfn(UNUSED(Param pm))
 	time_t t;
 
 	t = sch->time;
-	sprintf(tbuf, "%ld", t);
+#if defined(PRINTF_HAS_LLD)
+	sprintf(tbuf, "%lld", (long long)t);
+#else
+	sprintf(tbuf, "%ld", (long)t);
+#endif
 	if (sch->flags & SCHEDFLAG_TRASH_ZLE)
 	    flagstr = "-o";
 	else