1
0
mirror of https://github.com/Llewellynvdm/conky.git synced 2024-11-15 17:47:09 +00:00

convert entropy_barval to double

This commit is contained in:
Phil Sutter 2009-12-04 01:35:23 +01:00
parent 2fc1efa8d5
commit c52ee46cc3
3 changed files with 4 additions and 4 deletions

View File

@ -1499,7 +1499,7 @@ struct text_object *construct_text_object(const char *s, const char *arg, long
END OBJ(entropy_poolsize, &update_entropy)
obj->callbacks.print = &print_entropy_poolsize;
END OBJ(entropy_bar, &update_entropy)
scan_bar(obj, arg, 255);
scan_bar(obj, arg, 1);
obj->callbacks.barval = &entropy_barval;
END OBJ_ARG(include, 0, "include needs a argument")
struct conftree *leaf = conftree_add(currentconffile, arg);

View File

@ -73,9 +73,9 @@ void print_entropy_poolsize(struct text_object *obj, char *p, int p_max_size)
snprintf(p, p_max_size, "%u", entropy.poolsize);
}
uint8_t entropy_barval(struct text_object *obj)
double entropy_barval(struct text_object *obj)
{
(void)obj;
return round_to_int((double) entropy.avail * 255.0f / (double) entropy.poolsize);
return (double)entropy.avail / entropy.poolsize;
}

View File

@ -36,6 +36,6 @@ void update_entropy(void);
void print_entropy_avail(struct text_object *, char *, int);
uint8_t entropy_percentage(struct text_object *);
void print_entropy_poolsize(struct text_object *, char *, int);
uint8_t entropy_barval(struct text_object *);
double entropy_barval(struct text_object *);
#endif /* _ENTROPY_H */