diff options
| author | ilotterytea <iltsu@alright.party> | 2025-05-03 16:51:05 +0500 |
|---|---|---|
| committer | ilotterytea <iltsu@alright.party> | 2025-05-03 16:51:05 +0500 |
| commit | 1dd6e790fc87b6d4649fead8d319def9b1518801 (patch) | |
| tree | 57f607838968c9f10687a7df261ae81504719b2d | |
| parent | 2c51a000a9f2f51f54b761e4975086f9db3780a4 (diff) | |
fix: implicit conversion
| -rw-r--r-- | src/utils.php | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/utils.php b/src/utils.php index 6356cfb..87d96c6 100644 --- a/src/utils.php +++ b/src/utils.php @@ -41,10 +41,10 @@ function str_safe(string $s, int|null $max_length, bool $remove_new_lines = true function format_timestamp(int $timestamp_secs) { - $days = floor($timestamp_secs / (60 * 60 * 24)); - $hours = floor($timestamp_secs / (60 * 60) % 24); - $minutes = floor($timestamp_secs % (60 * 60) / 60); - $seconds = floor($timestamp_secs % 60); + $days = (int) floor($timestamp_secs / (60.0 * 60.0 * 24.0)); + $hours = (int) floor(round($timestamp_secs / (60 * 60)) % 24); + $minutes = (int) floor(round($timestamp_secs % (60 * 60)) / 60); + $seconds = (int) floor($timestamp_secs % 60); if ($days == 0 && $hours == 0 && $minutes == 0) { return "$seconds second" . ($seconds > 1 ? "s" : ""); |
