Re: [chrony-dev] Avoid large times in chronyc sources / sourcestats overflowing

[ Thread Index | Date Index | More chrony.tuxfamily.org/chrony-dev Archives ]


On Sun, Mar 28, 2010 at 06:17:55PM +0200, Håkan Johansson wrote:
> 
> The attached patch changes the formatting of (nano)seconds such that
> very large time offsets does not cause the lines of 'sources' or
> 'sourcestats' to overflow.  Root cause was the conversion from
> double to int that gave misleading values, fooing the following
> logics.  %f formatting in printf rounds by itself.

Thanks. I've just few comments.

> From: H J <a@b.c>

This doesn't look like a valid address :).

> +  if (fabs(s) <= 9999e-9) {

I think "< 9999.5e-9" would be more precise, similar for the other cases.

> +  } else if (fabs(s) <= 1025) {
> +    printf("%5.0fs",s);
>    } else {
> -    printf("%5lds", (ms + 500) / 1000);
> +    printf(" ");
> +    print_seconds((unsigned long) fabs(s));
>    }
>  }

There will be an inconsistency as print_seconds() doesn't use "s" for
seconds. Also I'm not sure it's better to print offsets in minutes,
hours or days instead of seconds.

-- 
Miroslav Lichvar

---
To unsubscribe email chrony-dev-request@xxxxxxxxxxxxxxxxxxxx with "unsubscribe" in the subject.
For help email chrony-dev-request@xxxxxxxxxxxxxxxxxxxx with "help" in the subject.
Trouble?  Email listmaster@xxxxxxxxxxxxxxxxxxxx.


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/