mirror of
https://github.com/Llewellynvdm/conky.git
synced 2024-11-17 18:45:10 +00:00
Bugfix: Sx in $format_time prints out wrong values when number of seconds ends with a zero and has no numbers behind the point
This commit is contained in:
parent
7291184783
commit
b85b0d5aab
@ -235,11 +235,14 @@ void print_format_time(struct text_object *obj, char *p, unsigned int p_max_size
|
||||
if(*currentchar >= '0' && *currentchar <= '9') {
|
||||
asprintf(&temp, "%.*f", (*currentchar) - '0', seconds);
|
||||
} else if(*currentchar == 'x') {
|
||||
if(seconds == (int) seconds ) {
|
||||
asprintf(&temp, "%d", (int) seconds);
|
||||
} else {
|
||||
asprintf(&temp, "%.9f", seconds);
|
||||
while(*(temp + strlen(temp) - 1) == '0' || *(temp + strlen(temp) - 1) == '.') {
|
||||
*(temp + strlen(temp) - 1) = 0;
|
||||
}
|
||||
if(*temp == 0) *temp = '0';
|
||||
}
|
||||
}else{
|
||||
currentchar--;
|
||||
NORM_ERR("$format_time needs a digit behind 'S' to specify precision")
|
||||
|
Loading…
Reference in New Issue
Block a user