mirror of
https://codeberg.org/dnkl/yambar.git
synced 2025-06-16 00:05:40 +02:00
tag: use as_float() when kb/mb/gb formatting a float tag value
This commit is contained in:
parent
c738f1c63d
commit
de4814d16e
2 changed files with 9 additions and 3 deletions
5
tag.c
5
tag.c
|
@ -582,7 +582,10 @@ tags_expand_template(const char *template, const struct tag_set *tags)
|
|||
1;
|
||||
|
||||
char str[24];
|
||||
snprintf(str, sizeof(str), "%lu", tag->as_int(tag) / divider);
|
||||
if (tag->type(tag) == TAG_TYPE_FLOAT)
|
||||
snprintf(str, sizeof(str), "%f", tag->as_float(tag) / (double)divider);
|
||||
else
|
||||
snprintf(str, sizeof(str), "%lu", tag->as_int(tag) / divider);
|
||||
sbuf_append(&formatted, str);
|
||||
break;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue