* [PATCH] cangen: allow double value for gap
@ 2012-07-11 14:23 Alexander Stein
2012-07-13 5:43 ` Oliver Hartkopp
0 siblings, 1 reply; 2+ messages in thread
From: Alexander Stein @ 2012-07-11 14:23 UTC (permalink / raw)
To: linux-can; +Cc: Alexander Stein
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
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] cangen: allow double value for gap
2012-07-11 14:23 [PATCH] cangen: allow double value for gap Alexander Stein
@ 2012-07-13 5:43 ` Oliver Hartkopp
0 siblings, 0 replies; 2+ messages in thread
From: Oliver Hartkopp @ 2012-07-13 5:43 UTC (permalink / raw)
To: Alexander Stein; +Cc: linux-can
On 11.07.2012 16:23, Alexander Stein wrote:
> 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>
Applied to can-utils.
Nice idea!
Regards,
Oliver
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2012-07-13 5:43 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-07-11 14:23 [PATCH] cangen: allow double value for gap Alexander Stein
2012-07-13 5:43 ` Oliver Hartkopp
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.