bad print in hdparm.c
Denys Vlasenko
vda.linux at googlemail.com
Wed May 20 21:22:56 UTC 2009
On Wednesday 20 May 2009 15:03, Alessandro Rubini wrote:
> > Fixed in git, thanks!
>
> Well, I don't think it's correct. If the number is (for example) 2 it
> means 10 seconds. The original:
>
> printf("%u minutes %u seconds", standby / 12, (standby*5) % 60);
>
> would have printed " 0minutes 10 seconds". Current code in git:
>
> printf("%u minutes %u seconds", standby / (60/5), standby % (60/5));
>
> prints "0 minutes 2 seconds". Which is wrong. I'm not posting a patch
> because I would personally reinstantiate the original code. If needed
> a comment like:
>
> /* standby counts 5-second intervals */
>
> would help better than changing the code.
Fixed. Code now looks like this:
/* standby is in 5 sec units */
unsigned t = standby * 5;
printf("%u minutes %u seconds", t / 60, t % 60);
--
vda
More information about the busybox
mailing list