From: Peter Stephenson <p.w.stephenson@ntlworld.com>
To: zsh-workers@zsh.org
Subject: Re: patch to mailcheck missing new emails
Date: Sun, 11 Aug 2013 19:36:37 +0100 [thread overview]
Message-ID: <20130811193637.3e42fa6b@pws-pc.ntlworld.com> (raw)
In-Reply-To: <20130810195138.3472046a@pws-pc.ntlworld.com>
On Sat, 10 Aug 2013 19:51:38 +0100
Peter Stephenson <p.w.stephenson@ntlworld.com> wrote:
> (Separate issue noted in passing: we should probably use zlong for
> period and mailcheck to be safe; efficiency isn't really an issue.)
Joe sent me a patch, but I'd already done the following (very similar)
which I might as well post...
diff --git a/Src/utils.c b/Src/utils.c
index 6d9ffe3..d1d9406 100644
--- a/Src/utils.c
+++ b/Src/utils.c
@@ -1289,8 +1289,8 @@ preprompt(void)
static time_t lastperiodic;
time_t currentmailcheck;
LinkNode ln;
- int period = getiparam("PERIOD");
- int mailcheck = getiparam("MAILCHECK");
+ zlong period = getiparam("PERIOD");
+ zlong mailcheck = getiparam("MAILCHECK");
/*
* Handle any pending window size changes before we compute prompts,
@@ -1338,7 +1338,7 @@ preprompt(void)
/* If 1) the parameter PERIOD exists, 2) a hook function for *
* "periodic" exists, 3) it's been greater than PERIOD since we *
* executed any such hook, then execute it now. */
- if (period && (time(NULL) > lastperiodic + period) &&
+ if (period && ((zlong)time(NULL) > (zlong)lastperiodic + period) &&
!callhookfunc("periodic", NULL, 1, NULL))
lastperiodic = time(NULL);
if (errflag)
@@ -1358,7 +1358,7 @@ preprompt(void)
/* Check mail */
currentmailcheck = time(NULL);
if (mailcheck &&
- (int) difftime(currentmailcheck, lastmailcheck) > mailcheck) {
+ (zlong) difftime(currentmailcheck, lastmailcheck) > mailcheck) {
char *mailfile;
if (mailpath && *mailpath && **mailpath)
--
Peter Stephenson <p.w.stephenson@ntlworld.com>
Web page now at http://homepage.ntlworld.com/p.w.stephenson/
prev parent reply other threads:[~2013-08-11 18:44 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-08-09 19:54 joe M
2013-08-10 18:51 ` Peter Stephenson
2013-08-11 18:36 ` Peter Stephenson [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20130811193637.3e42fa6b@pws-pc.ntlworld.com \
--to=p.w.stephenson@ntlworld.com \
--cc=zsh-workers@zsh.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).