[LinuxPPS] [PATCH 01/11] PPS: Don't waste time getting unnecessary timestamps.
Rodolfo Giometti
giometti at enneenne.com
Mon Feb 9 22:30:48 CET 2009
On Fri, Feb 06, 2009 at 08:25:38AM -0500, George Spelvin wrote:
> Here is a patch series for cleaning up linuxpps 5.3.4.
>
> ---
> drivers/pps/clients/pps-ldisc.c | 16 ++++++----------
> 1 files changed, 6 insertions(+), 10 deletions(-)
>
> diff --git a/drivers/pps/clients/pps-ldisc.c b/drivers/pps/clients/pps-ldisc.c
> index f16396b..0406f40 100644
> --- a/drivers/pps/clients/pps-ldisc.c
> +++ b/drivers/pps/clients/pps-ldisc.c
> @@ -33,17 +33,13 @@ static void pps_tty_dcd_change(struct tty_struct *tty, unsigned int status,
> struct timespec __ts;
> struct pps_ktime pps_ts;
>
> - /* First of all we get the time stamp... */
> - getnstimeofday(&__ts);
> -
> - /* Does caller give us a timestamp? */
> - if (ts) { /* Yes. Let's use it! */
> - pps_ts.sec = ts->tv_sec;
> - pps_ts.nsec = ts->tv_nsec;
> - } else { /* No. Do it ourself! */
> - pps_ts.sec = __ts.tv_sec;
> - pps_ts.nsec = __ts.tv_nsec;
> + /* Get timestamp if necessary */
> + if (!ts) {
> + getnstimeofday(&__ts);
> + ts = &__ts;
> }
> + pps_ts.sec = ts->tv_sec;
> + pps_ts.nsec = ts->tv_nsec;
Nack.
Function getnstimeofday() should be called as soon as possible since
even a little delay may cause a large timing error! So is better
calling getnstimeofday() even if not necessary then delay it.
Ciao,
Rodolfo
--
GNU/Linux Solutions e-mail: giometti at enneenne.com
Linux Device Driver giometti at linux.it
Embedded Systems phone: +39 349 2432127
UNIX programming skype: rodolfo.giometti
More information about the LinuxPPS
mailing list