From: Alexander Stein <alexander.stein@systec-electronic.com> To: linux-can@vger.kernel.org Cc: Alexander Stein <alexander.stein@systec-electronic.com> Subject: [PATCH] cangen: allow double value for gap Date: Wed, 11 Jul 2012 16:23:12 +0200 [thread overview] Message-ID: <1342016592-1401-1-git-send-email-alexander.stein@systec-electronic.com> (raw) This way a user can specify a gap below 1ms. This is somehwat similar to setting the gap to 0, but the ENOBUFS are greatly reduced, so a given amount of CAN messages by -n is still usefull and useable. Signed-off-by: Alexander Stein <alexander.stein@systec-electronic.com> --- cangen.c | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) diff --git a/cangen.c b/cangen.c index 20cc921..4f37808 100644 --- a/cangen.c +++ b/cangen.c @@ -132,7 +132,7 @@ void sigterm(int signo) int main(int argc, char **argv) { - unsigned long gap = DEFAULT_GAP; + double gap = DEFAULT_GAP; unsigned long polltimeout = 0; unsigned char ignore_enobufs = 0; unsigned char extended = 0; @@ -173,7 +173,7 @@ int main(int argc, char **argv) break; case 'g': - gap = strtoul(optarg, NULL, 10); + gap = strtod(optarg, NULL); break; case 'e': @@ -251,7 +251,7 @@ int main(int argc, char **argv) } ts.tv_sec = gap / 1000; - ts.tv_nsec = (gap % 1000) * 1000000; + ts.tv_nsec = ((int)(gap * 1000000)) % 1000000000; if (id_mode == MODE_FIX) { -- 1.7.8.6
next reply other threads:[~2012-07-11 14:23 UTC|newest] Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top 2012-07-11 14:23 Alexander Stein [this message] 2012-07-13 5:43 ` Oliver Hartkopp
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=1342016592-1401-1-git-send-email-alexander.stein@systec-electronic.com \ --to=alexander.stein@systec-electronic.com \ --cc=linux-can@vger.kernel.org \ --subject='Re: [PATCH] cangen: allow double value for gap' \ /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
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.