1
0
mirror of https://github.com/Llewellynvdm/conky.git synced 2024-11-05 21:07:52 +00:00

Added support for \Sx to $format_time

This commit is contained in:
Nikolas Garofil 2009-11-19 00:04:49 +01:00
parent 4a1be880d3
commit 59594e70d2
2 changed files with 8 additions and 0 deletions

View File

@ -1123,6 +1123,8 @@
then you can see the numbers behind the point by using \S
followed by a number that specifies the amount of
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>
</varlistentry>
<varlistentry>

View File

@ -217,6 +217,12 @@ void print_format_time(struct text_object *obj, char *p, unsigned int p_max_size
currentchar++;
if(*currentchar >= '0' && *currentchar <= '9') {
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{
currentchar--;
NORM_ERR("$format_time needs a digit behind 'S' to specify precision")