diff options
author | Suren A. Chilingaryan <csa@suren.me> | 2015-04-27 02:28:57 +0200 |
---|---|---|
committer | Suren A. Chilingaryan <csa@suren.me> | 2015-04-27 02:28:57 +0200 |
commit | e1265fa32837f457ee2c2fa259d12c9545af4bbf (patch) | |
tree | 64b8d5f1c81c14f019047b0cb00cb77c2dcecf55 /pcitool/formaters.c | |
parent | a37beb44d59cca329d0d9345c21505af81030688 (diff) | |
download | ipecamera-e1265fa32837f457ee2c2fa259d12c9545af4bbf.tar.gz ipecamera-e1265fa32837f457ee2c2fa259d12c9545af4bbf.tar.bz2 ipecamera-e1265fa32837f457ee2c2fa259d12c9545af4bbf.tar.xz ipecamera-e1265fa32837f457ee2c2fa259d12c9545af4bbf.zip |
First stand-alone ipecamera implementation
Diffstat (limited to 'pcitool/formaters.c')
-rw-r--r-- | pcitool/formaters.c | 47 |
1 files changed, 0 insertions, 47 deletions
diff --git a/pcitool/formaters.c b/pcitool/formaters.c deleted file mode 100644 index 91b8c77..0000000 --- a/pcitool/formaters.c +++ /dev/null @@ -1,47 +0,0 @@ -#include <stdio.h> - -void PrintTime(size_t duration) { - if (duration > 999999999999) printf("%4.1lf""d", 1.*duration/86400000000); - else if (duration > 99999999999) printf("%4.1lf""h", 1.*duration/3600000000); - else if (duration > 9999999999) printf("%4.2lf""h", 1.*duration/3600000000); - else if (duration > 999999999) printf("%4.1lf""m", 1.*duration/60000000); - else if (duration > 99999999) printf("%4.2lf""m", 1.*duration/60000000); - else if (duration > 9999999) printf("%4.1lf""s", 1.*duration/1000000); - else if (duration > 999999) printf("%4.2lf""s", 1.*duration/1000000); - else if (duration > 999) printf("%3lu""ms", duration/1000); - else printf("%3lu""us", duration); -} - -void PrintNumber(size_t num) { - if (num > 999999999999999999) printf("%3lue", num/1000000000000000000); - else if (num > 999999999999999) printf("%3lup", num/1000000000000000); - else if (num > 999999999999) printf("%3lut", num/1000000000000); - else if (num > 999999999) printf("%3lug", num/1000000000); - else if (num > 999999) printf("%3lum", num/1000000); - else if (num > 9999) printf("%3luk", num/1000); - else printf("%4lu", num); -} - -void PrintSize(size_t num) { - if (num >= 112589990684263) printf("%4.1lf PB", 1.*num/1125899906842624); - else if (num >= 109951162778) printf("%4.1lf TB", 1.*num/1099511627776); - else if (num >= 107374183) printf("%4.1lf GB", 1.*num/1073741824); - else if (num >= 1048576) printf("%4lu MB", num/1048576); - else if (num >= 1024) printf("%4lu KB", num/1024); - else printf("%5lu B", num); -} - -void PrintPercent(size_t num, size_t total) { - if (num >= total) printf(" 100"); - else printf("%4.1lf", 100.*num/total); - -} - -char *GetPrintSize(char *str, size_t size) { - if (size >= 1073741824) sprintf(str, "%.1lf GB", 1.*size / 1073741824); - else if (size >= 1048576) sprintf(str, "%.1lf MB", 1.*size / 1048576); - else if (size >= 1024) sprintf(str, "%lu KB", size / 1024); - else sprintf(str, "%lu B ", size); - - return str; -} |