SrtParser\srtFileEntry::ms2tc PHP Method

ms2tc() public static method

Converts milliseconds into timecode string
public static ms2tc ( integer $ms ) : string
$ms integer
return string
    public static function ms2tc($ms)
    {
        $tc_ms = round(($ms / 1000 - intval($ms / 1000)) * 1000);
        $x = $ms / 1000;
        $tc_s = intval($x % 60);
        $x /= 60;
        $tc_m = intval($x % 60);
        $x /= 60;
        $tc_h = intval($x % 24);
        $timecode = str_pad($tc_h, 2, '0', STR_PAD_LEFT) . ':' . str_pad($tc_m, 2, '0', STR_PAD_LEFT) . ':' . str_pad($tc_s, 2, '0', STR_PAD_LEFT) . ',' . str_pad($tc_ms, 3, '0', STR_PAD_LEFT);
        return $timecode;
    }