Added slideshow support

This commit is contained in:
Bert
2011-09-10 18:41:20 +02:00
parent 79d780a701
commit 510512714d
10 changed files with 136 additions and 35 deletions

13
util.c
View File

@ -127,8 +127,17 @@ void size_readable(float *size, const char **unit) {
const char *units[] = { "", "K", "M", "G" };
int i;
for (i = 0; i < ARRLEN(units) && *size > 1024; i++)
*size /= 1024;
for (i = 0; i < ARRLEN(units) && *size > 1024.0; i++)
*size /= 1024.0;
*unit = units[MIN(i, ARRLEN(units) - 1)];
}
void time_readable(float *time, const char **unit) {
const char *units[] = { "s", "m", "h" };
int i;
for (i = 0; i < ARRLEN(units) && *time >= 60.0; i++)
*time /= 60.0;
*unit = units[MIN(i, ARRLEN(units) - 1)];
}