nix/files/i3status-format-fix.patch
2024-10-16 16:08:40 +02:00

23 lines
1.1 KiB
Diff

diff --git a/src/print_cpu_usage.c b/src/print_cpu_usage.c
index a7ee2e4..1821a99 100644
--- a/src/print_cpu_usage.c
+++ b/src/print_cpu_usage.c
@@ -201,7 +201,7 @@ void print_cpu_usage(cpu_usage_ctx_t *ctx) {
*(outwalk++) = *walk;
} else if (BEGINS_WITH(walk + 1, "usage")) {
- outwalk += sprintf(outwalk, "%02d%s", diff_usage, pct_mark);
+ outwalk += sprintf(outwalk, "%d%s", diff_usage, pct_mark);
walk += strlen("usage");
}
#if defined(__linux__)
@@ -217,7 +217,7 @@ void print_cpu_usage(cpu_usage_ctx_t *ctx) {
int cpu_diff_idle = curr_cpus[number].idle - prev_cpus[number].idle;
int cpu_diff_total = curr_cpus[number].total - prev_cpus[number].total;
int cpu_diff_usage = (cpu_diff_total ? (1000 * (cpu_diff_total - cpu_diff_idle) / cpu_diff_total + 5) / 10 : 0);
- outwalk += sprintf(outwalk, "%02d%s", cpu_diff_usage, pct_mark);
+ outwalk += sprintf(outwalk, "%d%s", cpu_diff_usage, pct_mark);
}
walk += length;
}