mirror of
https://github.com/Llewellynvdm/conky.git
synced 2024-11-17 18:45:10 +00:00
Added support for \Sx to $format_time
This commit is contained in:
parent
4a1be880d3
commit
59594e70d2
@ -1123,6 +1123,8 @@
|
|||||||
then you can see the numbers behind the point by using \S
|
then you can see the numbers behind the point by using \S
|
||||||
followed by a number that specifies the amount of
|
followed by a number that specifies the amount of
|
||||||
digits behind the point that you want to see (maximum 9).
|
digits behind the point that you want to see (maximum 9).
|
||||||
|
You can also place a 'x' behind \S so you have all digits behind
|
||||||
|
the point and no trailing zero's. (also maximum 9)
|
||||||
<para /></listitem>
|
<para /></listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
<varlistentry>
|
<varlistentry>
|
||||||
|
@ -217,6 +217,12 @@ void print_format_time(struct text_object *obj, char *p, unsigned int p_max_size
|
|||||||
currentchar++;
|
currentchar++;
|
||||||
if(*currentchar >= '0' && *currentchar <= '9') {
|
if(*currentchar >= '0' && *currentchar <= '9') {
|
||||||
asprintf(&temp, "%.*f", (*currentchar) - '0', seconds);
|
asprintf(&temp, "%.*f", (*currentchar) - '0', seconds);
|
||||||
|
} else if(*currentchar == 'x') {
|
||||||
|
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{
|
}else{
|
||||||
currentchar--;
|
currentchar--;
|
||||||
NORM_ERR("$format_time needs a digit behind 'S' to specify precision")
|
NORM_ERR("$format_time needs a digit behind 'S' to specify precision")
|
||||||
|
Loading…
Reference in New Issue
Block a user