Returns current time with hundredths of a second.

@param string $sFormat including %s for cs, eg: 'Y-m-d H:i:s.%s'
@return string current time with hundredths of a second.
767288
public static function getCurrentTimeWithCS ($sFormat)
    {
        $aMicrotime = explode(' ', microtime());
        $sFilledFormat = sprintf($sFormat, $aMicrotime[0]*1000000);
        $sDate = date($sFilledFormat, $aMicrotime[1]);
        return $sDate;
    }
377001
def get_formatted_time(seconds: float) -> str:
    
    seconds = round(seconds)
    m, s = divmod(seconds, 60)
    h, m = divmod(m, 60)
    return '{:d}:{:02d}:{:02d}'.format(h, m, s)
678225
public static function timeToText($time)
    {
        $timeHour   = ceil($time * 60);
        $modMinutes = $timeHour % 60;
        $hour       = floor($time);

        return $hour . ' h ' . $modMinutes . ' m';
    }
294420
public static function getReadableTime($time)
    {
        if ($time < 1000) {
            return "{$time}ms";
        }

        $prefix = '';
        if ($time >= 60000) {
            $prefix = floor($time / 60000) . 'm ';
            $time = $time % 60000;
        }

        return $prefix . number_format((float) ($time / 1000), 3, '.', '') . 's';
    }
204512
private function seconds()
    {
        // Seconds value can be an integer or float
        if ($this->lexer->isNextTokenAny(array(Lexer::T_INTEGER, Lexer::T_FLOAT))) {
            $seconds = $this->number();

            // Throw exception if seconds are greater than 60
            if ($seconds > 60) {
                throw $this->rangeError('Seconds', 60);
            }

            // Get fractional seconds
            $seconds /= 3600;

            // Match seconds symbol if requirement not colon
            if (Lexer::T_COLON !== $this->nextSymbol) {
                $this->symbol();
            }

            // Return value
            return $seconds;
        }

        // No seconds were present so return 0
        return 0;
    }
449343
public function currentUtcDatetime()
    {
        if ($this->timeFormat === static::$timeFormatDatetime) {
            return gmdate('Y-m-d H:i:s');
        }
        if ($this->timeFormat === static::$timeFormatTimestamp) {
            return time();
        }
        return null;
    }
1110513
public static function subtractMinute($ts = null, $num = 1)
	{
		return sfTime::subtract($ts, $num, sfTime::MINUTE);
	}
893756
public function replaceBy($sContent, $sFormat = '"%b %e, %Y"') 
	{
		$aTransformFormat = array('%D', '%h', '%n', '%r', '%R', '%t', '%T');
		$aTransformFormatFinal = array('%m/%d/%y', '%b', "\n", '%I:%M:%S %p', '%H:%M', "\t", '%H:%M:%S');

		if (strpos($sFormat, '%e') !== false) {

			$aTransformFormat[] = '%e';
			$aTransformFormatFinal[] = sprintf('%\' 2d', date('j', $sContent));
		}

		if (strpos($sFormat, '%l') !== false) {

			$aTransformFormat[] = '%l';
			$aTransformFormatFinal[] = sprintf('%\' 2d', date('h', $sContent));
		}

		$sFormat = str_replace($aTransformFormat, $aTransformFormatFinal, $sFormat);

		return '{strftime('.$sFormat.', '.$sContent.')}';
	}
1294542
public function dailyAt($time): self
    {
        $segments = \explode(':', $time);
        $firstSegment = (int) $segments[0];
        $secondSegment = \count($segments) > 1
            ? (int) $segments[1]
            : '0'
        ;

        return $this
            ->spliceIntoPosition(2, (string) $firstSegment)
            ->spliceIntoPosition(1, (string) $secondSegment)
        ;
    }
1273056
private function convertToSecondsIfNeeded($time)
    {
        if (!is_numeric($time)) {
            $now = microtime(true);

            $time = ceil(strtotime($time, $now) - $now);
        }

        return $time;
    }
881611
protected function getFormatTime($time)
    {
        // Remaining times
        $hours = str_pad(floor($time / 60 / 60), 2, '0', STR_PAD_LEFT);
        $minutes = str_pad(floor(($time - ((int)$hours * 60 * 60)) / 60), 2, '0', STR_PAD_LEFT);
        $seconds = str_pad(floor(($time - ((int)$hours * 60 * 60) - ((int)$minutes * 60))), 2, '0', STR_PAD_LEFT);

        return "$hours:$minutes:$seconds";
    }
267297
def fmt_second(time_total):
    

    def _ck(t):
        return t < 10 and "0%s" % t or t

    times = int(time_total)
    h = times / 3600
    m = times % 3600 / 60
    s = times % 3600 % 60
    return "%s:%s:%s" % (_ck(h), _ck(m), _ck(s))
1297956
static public function get_time() {
        // By David Maciel (jdmaciel@gmail.com)
        list($microsecond, $second) = explode(" ", \microtime());
        // remove '0.' from the beginning and trailing zeros(2) from the end
        $microsecond = substr($microsecond, 2, -2);
        return (int) $second . $microsecond;
    }
1185328
public static function timestampToSeconds($string)
    {
        // Extract hour, minute, and seconds
        $time = explode(":", $string);
        
        // Convert to seconds (round up to nearest second)
        $secs = ($time[0] * 3600) + ($time[1] * 60) + (ceil($time[2]));
        return $secs;
    }
1051261
public static function seconds($seconds, $is_ms = FALSE, $format = "%dD %02d:%02d:%02d")
  {
    if($is_ms) $seconds = $seconds/1000;

    return sprintf($format, $seconds/60/60/24, ($seconds/60/60)%24, ($seconds/60)%60, $seconds%60);
  }
98382
public function getFormattedTime(
        $time,
        $precision = 0,
        $floatingPrecision = 3,
        $showUnit = true
    ) {

        $test = is_int(
                $precision
            ) && $precision >= 0 && $precision <= 2 &&
            is_float($time) &&
            is_int($floatingPrecision) && $floatingPrecision >= 0 &&
            is_bool($showUnit);

        if ($test) {
            $duration = round($time * 10 * ($precision * 3), $floatingPrecision);

            if ($showUnit) {
                switch ($precision) {
                    case 0 :
                        return $duration . ' s';
                    case 1 :
                        return $duration . ' ms';
                    case 2 :
                        return $duration . ' µs';
                    default :
                        return $duration . ' (no unit)';
                }
            } else {
                return $duration;
            }
        } else {
            return 'Can\'t return the render time';
        }
    }
76981
protected function formatTime($time)
    {
        if ($time > 100) {
            $time /= 60;
            if ($time > 100) {
                $time /= 60;

                return number_format($time) . " hr";
            }

            return number_format($time) . " min";
        }

        return number_format($time) . " sec";
    }