Subject: Re: ppsratecheck(9)
To: None <tech-kern@netbsd.org>
From: None <enami@but-b.or.jp>
List: tech-kern
Date: 07/07/2000 23:13:15
> + if ((lasttime->tv_sec == 0 && lasttime->tv_usec == 0) ||
> + delta.tv_sec > 0) {
> + *lasttime = mono_time;
> + *curpps = 0;
> + rv = 1;
> + } else if (*curpps < maxpps)
> + rv = 1;
> + else
> + rv = 0;
> + /* be careful about wrap-around */
> + if (*curpps + 1 > *curpps)
> + *curpps = *curpps + 1;
If it reached to the limit, we don't need to increment it, do we? And
if we aren't reached to the limit yet, we can safely increment it. I.e.,
if (needtoreset) {
*cur = 1;
return (1);
} else if (*cur < max) {
(*cur)++;
return (1);
} else
return (0);
> you may have different idea about function names or argument types,
> i'm not good at naming things:-)
psratecheck (per second rate check)? I'll strongly agree with you
that at least the acronym pps isn't generic enough.
enami.