timestuff, was Re: performance, was Re: [LinuxPPS] patch report
Rodolfo Giometti
giometti at linux.it
Thu Jul 20 10:25:11 CEST 2006
On Tue, Jul 18, 2006 at 02:23:54PM -0700, gnu not unix wrote:
>
> Also, the timestamp in linuxpps_event occurs *after*
> a couple of "if" tests. I'm a bit skeptical about that,
> and I'm thinking of moving the gettimeofday to before
> the two if tests. No harm in doing it there, after all.
> I do exactly that in the shm parallel port pps driver
> code, just grab a timestamp and ignore it if needs be.
Did you mean something like this?
diff --git a/drivers/pps/kapi.c b/drivers/pps/kapi.c
index 71177bd..a225ebf 100644
--- a/drivers/pps/kapi.c
+++ b/drivers/pps/kapi.c
@@ -120,7 +120,11 @@ void linuxpps_event(int source, int even
{
struct timespec ts;
- /* Sanity checks */
+ /* First of all we get the time stamp... */
+ do_gettimeofday((struct timeval *) &ts);
+ ts.tv_nsec *= 1000; /* microseconds to nanoseconds */
+
+ /* ... then we can do some sanity checks */
if (!linuxpps_is_allocated(source)) {
err("unknow source for event!");
return;
@@ -130,10 +134,6 @@ void linuxpps_event(int source, int even
return;
}
- /* Get the time stamp */
- do_gettimeofday((struct timeval *) &ts);
- ts.tv_nsec *= 1000; /* microseconds to nanoseconds */
-
/* Must call the echo function? */
if ((linuxpps_source[source].params.mode&(PPS_ECHOASSERT|PPS_ECHOCLEAR)) != 0)
linuxpps_source[source].info->echo(source, event);
Ciao,
Rodolfo
--
GNU/Linux Solutions e-mail: giometti at enneenne.com
Linux Device Driver giometti at gnudd.com
Embedded Systems giometti at linux.it
UNIX programming phone: +39 349 2432127
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://ml.enneenne.com/pipermail/linuxpps/attachments/20060720/389a593c/attachment.pgp
More information about the LinuxPPS
mailing list