1: <?php
2: 3: 4: 5: 6: 7: 8: 9: 10:
11:
12: namespace ManiaLive\Utilities;
13:
14: class Time
15: {
16: static function fromTM($timestamp, $signed = false)
17: {
18: $time = (int)$timestamp;
19:
20: $negative = ($time < 0);
21: if ($negative)
22: {
23: $time = abs($time);
24: }
25:
26: $cent = str_pad(($time % 1000), 3, '0', STR_PAD_LEFT);
27: $time = floor($time / 1000);
28: $sec = str_pad($time % 60, 2, '0', STR_PAD_LEFT);
29: $min = str_pad(floor($time / 60), 1, '0');
30: $time = $min.':'.$sec.'.'.$cent;
31:
32: if ($signed)
33: {
34: return ($negative ? '-'.$time : '+'.$time);
35: }
36: else
37: {
38: return $time;
39: }
40: }
41: }
42:
43: ?>