diff options
Diffstat (limited to 'extras.c')
| -rw-r--r-- | extras.c | 7 |
1 files changed, 7 insertions, 0 deletions
| @@ -510,6 +510,13 @@ char * i3lock_format_elapsed_time(char *to, | |||
| 510 | 510 | ||
| 511 | char tmp_str[max_size]; | 511 | char tmp_str[max_size]; |
| 512 | char int_str[32]; /* more than enough for int */ | 512 | char int_str[32]; /* more than enough for int */ |
| 513 | |||
| 514 | if (seconds < 0) { | ||
| 515 | if (!(seconds % 3)) | ||
| 516 | return NULL; | ||
| 517 | seconds = 0; | ||
| 518 | } | ||
| 519 | |||
| 513 | int days = seconds / 86400; | 520 | int days = seconds / 86400; |
| 514 | int hours = (seconds - days * 86400) / 3600; | 521 | int hours = (seconds - days * 86400) / 3600; |
| 515 | int minutes = (seconds - days * 86400 - hours * 3600) / 60; | 522 | int minutes = (seconds - days * 86400 - hours * 3600) / 60; |
