bad print in hdparm.c

Gilles Espinasse g.esp at free.fr
Wed May 20 13:12:30 UTC 2009


----- Original Message ----- 
From: "Alessandro Rubini" <rubini-list at gnudd.com>
To: <vda.linux at googlemail.com>
Cc: <busybox at busybox.net>
Sent: Wednesday, May 20, 2009 3:03 PM
Subject: Re: bad print in hdparm.c


> > 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.
>
> /alessandro

I saw already in 1.13.4 and 1.14.0
  /* standby is in 5 sec units */
  printf("%u minutes %u seconds", standby / 12, (standby*5) % 60);

    Gilles



More information about the busybox mailing list