diff options
author | Rafael G. Martins <rafael@rafaelmartins.eng.br> | 2019-02-02 16:27:14 +0100 |
---|---|---|
committer | Rafael G. Martins <rafael@rafaelmartins.eng.br> | 2019-02-02 16:27:14 +0100 |
commit | 0b5ff9516f6ffda69b779a560d01c1a2dfb5e825 (patch) | |
tree | 7bb5cb087c8a8b3b18366e715393839205abc2ea /src | |
parent | 29031174ae315844f5847fda0df35b2807c3034c (diff) | |
download | blogc-0b5ff9516f6ffda69b779a560d01c1a2dfb5e825.tar.gz blogc-0b5ff9516f6ffda69b779a560d01c1a2dfb5e825.tar.bz2 blogc-0b5ff9516f6ffda69b779a560d01c1a2dfb5e825.zip |
blogc: rusage: fix formatting
Diffstat (limited to 'src')
-rw-r--r-- | src/blogc/rusage.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/blogc/rusage.c b/src/blogc/rusage.c index 7c04db3..6d88dc4 100644 --- a/src/blogc/rusage.c +++ b/src/blogc/rusage.c @@ -47,12 +47,12 @@ blogc_rusage_get(void) char* blogc_rusage_format_cpu_time(long long time) { - if (time > 1000000) + if (time >= 1000000) return bc_strdup_printf("%.3s", ((float) time) / 1000000.0); // this is a special case: some systems may report the cpu time rounded up to the // milisecond. it is useless to show ".000" in this case. - if (time > 1000) + if (time >= 1000) return bc_strdup_printf("%.*fms", time % 1000 ? 3 : 0, ((float) time) / 1000.0); return bc_strdup_printf("%dus", time); @@ -62,9 +62,9 @@ blogc_rusage_format_cpu_time(long long time) char* blogc_rusage_format_memory(long mem) { - if (mem > 1048576) + if (mem >= 1048576) return bc_strdup_printf("%.3fGB", ((float) mem) / 1048576.0); - if (mem > 1024) + if (mem >= 1024) return bc_strdup_printf("%.3fMB", ((float) mem) / 1024.0); return bc_strdup_printf("%dKB", mem); } |