bad print in hdparm.c

walter harms wharms at bfs.de
Wed May 20 13:33:25 UTC 2009



Alessandro Rubini schrieb:
>> 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.
> 

mmmh that would mean we need to multiply by 5 first to get [s] and then
do a standby / 60, standby % 60 ;
IMHO that would be better readable. Is this documented somewhere ?
or do drives vary on that any way ?

re,
 wh




More information about the busybox mailing list