module/alsa+backlight: round() percentage values

Closes #10
This commit is contained in:
Daniel Eklöf 2020-09-24 13:55:17 +02:00
parent 85ae4cca37
commit db53cf9245
No known key found for this signature in database
GPG key ID: 5BBD4992C116573F
4 changed files with 7 additions and 4 deletions

View file

@ -1,5 +1,6 @@
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <alsa/asoundlib.h>
@ -44,7 +45,7 @@ content(struct module *mod)
struct private *m = mod->private;
int percent = m->vol_max - m->vol_min > 0
? 100 * m->vol_cur / (m->vol_max - m->vol_min)
? round(100. * m->vol_cur / (m->vol_max - m->vol_min))
: 0;
mtx_lock(&mod->lock);