linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH BlueZ] mesh/onoff-model: Fix msec to sec conversion
@ 2017-11-25  9:01 Michal Hobot
  2017-11-27  8:53 ` Johan Hedberg
  0 siblings, 1 reply; 2+ messages in thread
From: Michal Hobot @ 2017-11-25  9:01 UTC (permalink / raw)
  To: linux-bluetooth@vger.kernel.org

There is an error in meshctl while displaying transition time. 1000 ms =
is being presented as 16 sec, 40 ms. The reason is incorrect conversion =
of milliseconds to seconds.
The fix is pretty trivial.

--- ../../bluez/mesh/onoff-model.c	2017-11-21 18:04:57.000000000 =
+0100
+++ onoff-model.c	2017-11-21 17:25:14.000000000 +0100
@@ -77,8 +77,8 @@ static void print_remaining_time(uint8_t
 	switch (step) {
 	case 0:
 		msecs =3D 100 * count;
-		secs =3D msecs / 60;
-		msecs -=3D (secs * 60);
+		secs =3D msecs / 1000;
+		msecs -=3D (secs * 1000);
 		break;
 	case 1:
 		secs =3D 1 * count;


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH BlueZ] mesh/onoff-model: Fix msec to sec conversion
  2017-11-25  9:01 [PATCH BlueZ] mesh/onoff-model: Fix msec to sec conversion Michal Hobot
@ 2017-11-27  8:53 ` Johan Hedberg
  0 siblings, 0 replies; 2+ messages in thread
From: Johan Hedberg @ 2017-11-27  8:53 UTC (permalink / raw)
  To: Michal Hobot; +Cc: linux-bluetooth@vger.kernel.org

Hi Michal

On Sat, Nov 25, 2017, Michal Hobot wrote:
> There is an error in meshctl while displaying transition time. 1000 ms
> is being presented as 16 sec, 40 ms. The reason is incorrect
> conversion of milliseconds to seconds.  The fix is pretty trivial.
> 
> --- ../../bluez/mesh/onoff-model.c	2017-11-21 18:04:57.000000000 +0100
> +++ onoff-model.c	2017-11-21 17:25:14.000000000 +0100
> @@ -77,8 +77,8 @@ static void print_remaining_time(uint8_t
>  	switch (step) {
>  	case 0:
>  		msecs = 100 * count;
> -		secs = msecs / 60;
> -		msecs -= (secs * 60);
> +		secs = msecs / 1000;
> +		msecs -= (secs * 1000);
>  		break;
>  	case 1:
>  		secs = 1 * count;

Thanks, the patch has been applied. I had to apply manually however and
fix up the commit message to make sure it adheres to a max 72 line
length. In the future, could you either try send patches using git
send-email, or at least format them with the help of git format-patch,
since what you sent now was unrecognizable to "git am" which is used for
applying patches. Thanks.

Johan

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-11-27  8:53 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-11-25  9:01 [PATCH BlueZ] mesh/onoff-model: Fix msec to sec conversion Michal Hobot
2017-11-27  8:53 ` Johan Hedberg

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).