Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
[patch] Missing cast when printing time_t
- X-seq: zsh-workers 38513
- From: Matthew Martin <phy1729@xxxxxxxxx>
- To: zsh-workers@xxxxxxx
- Subject: [patch] Missing cast when printing time_t
- Date: Wed, 18 May 2016 21:51:46 -0500
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:to:subject:message-id:mail-followup-to:mime-version :content-disposition:user-agent; bh=JD6MSFyoxIQbK5tYYXobh00PHZ0OoLmSxttpgtSuUoM=; b=LV7PfBz4SdOI7vzBz6r2OimuxhClmf7YWrwG5EOuWC2cOtwca+W0UbRMUgM2s8QLpp 4yEv3Tw/uXvVrqddOAZjaM1tLnZcTrEyQOXoEBHHyncnU9RPeYpNiO0U0/iJUCcSj/nf WcC2uDmwQLyjU8iD4NS7IXRMBQm+AEvtnxafoiNxBtxYSDns83lODlNjfKPdcf1v0IKl VcrNvcMN9wyGLlA4jDQs5a7x0v0Kl2z4S+kfI0yRl3LnIlP6cwxDkLBHk1LE5SUH+Jn3 qVAhDQCI5tkVDEaRVnlPJdFrSQyylLOvKqw00C6gJZ3y9W7ZQG5FgAVqdChpGJlNF0Ka werg==
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- Mail-followup-to: zsh-workers@xxxxxxx
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
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
Messages sorted by:
Reverse Date,
Date,
Thread,
Author