From: Yegor Yefremov <yegorslists@googlemail.com>
To: linux-can@vger.kernel.org
Cc: Yegor Yefremov <yegorslists@googlemail.com>
Subject: [PATCH] canplayer: convert skipgap to unsigned long
Date: Thu, 9 Apr 2015 23:01:21 +0200 [thread overview]
Message-ID: <1428613281-21827-1-git-send-email-yegorslists@googlemail.com> (raw)
The result of (last_log_tv.tv_sec - log_tv.tv_sec) is
unsigned long, so use labs() in order not to trim the
value to int. Make skipgap to unsigned long for the same
reason.
Signed-off-by: Yegor Yefremov <yegorslists@googlemail.com>
---
canplayer.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/canplayer.c b/canplayer.c
index f74668e..437ed4b 100644
--- a/canplayer.c
+++ b/canplayer.c
@@ -86,7 +86,7 @@ void print_usage(char *prg)
"send frames immediately)\n");
fprintf(stderr, " -g <ms> (gap in milli "
"seconds - default: %d ms)\n", DEFAULT_GAP);
- fprintf(stderr, " -s <s> (skip gaps in "
+ fprintf(stderr, " -s <s> (skip gaps in "
"timestamps > 's' seconds)\n");
fprintf(stderr, " -x (disable local "
"loopback of sent CAN frames)\n");
@@ -241,7 +241,8 @@ int main(int argc, char **argv)
FILE *infile = stdin;
unsigned long gap = DEFAULT_GAP;
int use_timestamps = 1;
- static int verbose, opt, delay_loops, skipgap;
+ static int verbose, opt, delay_loops;
+ static unsigned long skipgap;
static int loopback_disable = 0;
static int infinite_loops = 0;
static int loops = DEFAULT_LOOPS;
@@ -482,7 +483,7 @@ int main(int argc, char **argv)
/* test for logfile timestamps jumping backwards OR */
/* if the user likes to skip long gaps in the timestamps */
if ((last_log_tv.tv_sec > log_tv.tv_sec) ||
- (skipgap && abs(last_log_tv.tv_sec - log_tv.tv_sec) > skipgap))
+ (skipgap && labs(last_log_tv.tv_sec - log_tv.tv_sec) > skipgap))
create_diff_tv(&today_tv, &diff_tv, &log_tv);
last_log_tv = log_tv;
--
2.1.0
next reply other threads:[~2015-04-09 21:01 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-04-09 21:01 Yegor Yefremov [this message]
2015-04-10 9:29 ` [PATCH] canplayer: convert skipgap to unsigned long Oliver Hartkopp
2015-04-10 9:33 ` Yegor Yefremov
2015-04-10 9:37 ` Oliver Hartkopp
2015-04-10 9:37 ` Yegor Yefremov
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=1428613281-21827-1-git-send-email-yegorslists@googlemail.com \
--to=yegorslists@googlemail.com \
--cc=linux-can@vger.kernel.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.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox