return seconds from dhms
6379
def s_from_dhms(time):
    """"""
    dhms_s = { 's' : 1, 'm' : 60, 'h' : 3600, 'd' : 86400 }
    time = time.lower()
    word_list = re.findall('\d*[^\d]*',time)
    seconds=0 
    for word in word_list:
        if word != '':
            sec = 1
            for t in list(dhms_s.keys()):
                nw = word.replace(t,'')
                if nw != word:
                    sec = dhms_s[t]
                    word = nw
                    break
            try:
                seconds += int(word) * sec
            except:
                raise RuntimeError('unknown format in timestring ' + time)
    return seconds
894760
def seconds2time(s):
    """"""
    hour, temp = divmod(s, 3600)
    minute, temp = divmod(temp, 60)
    temp, second = math.modf(temp)
    return datetime.time(hour=int(hour), minute=int(minute), second=int(second),
                         microsecond=int(round(temp * 1e6)))
1028372
function(mod) {
			var seconds = this.getTimeSeconds();
			
			if(mod) {
				if(seconds == 60) {
					seconds = 0;
				}
				else {
					seconds = seconds % 60;
				}
			}
			
			return Math.ceil(seconds);
		}
1316487
def duration(seconds):
    """"""
    if seconds < 1:
        return 'less than 1 sec'
    seconds = int(round(seconds))
    components = []
    for magnitude, label in ((3600, 'hr'), (60, 'min'), (1, 'sec')):
        if seconds >= magnitude:
            components.append('{} {}'.format(seconds // magnitude, label))
            seconds %= magnitude
    return ' '.join(components)
301888
function timeCode(seconds, delim = ':') {
    // const h = Math.floor(seconds / 3600);
    // const m = Math.floor((seconds % 3600) / 60);
    const m = Math.floor(seconds / 60);
    const s = Math.floor((seconds % 3600) % 60);
    // const hr = (h < 10 ? '0' + h + delim : h + delim);
    const mn = (m < 10 ? '0' + m : m) + delim;
    const sc = (s < 10 ? '0' + s : s);
    // return hr + mn + sc;
    return mn + sc;
}
860919
def grok_seconds(lease):
    """"""
    if lease.endswith('s'):
        return int(lease[0:-1])
    elif lease.endswith('m'):
        return int(lease[0:-1]) * 60
    elif lease.endswith('h'):
        return int(lease[0:-1]) * 3600

    return None
144355
private function retrieveIntervalFromSeconds($seconds)
    {
        $result = '';
        $remainingTime = (int) $seconds;

        if (empty($remainingTime)) {
            $result .= 'PT0S';
        } else {
            $nbDays = (int) ($remainingTime / 86400);
            $remainingTime %= 86400;
            $nbHours = (int) ($remainingTime / 3600);
            $remainingTime %= 3600;
            $nbMinutes = (int) ($remainingTime / 60);
            $nbSeconds = $remainingTime % 60;
            $result .= 'P'.$nbDays.'DT'.$nbHours.'H'.$nbMinutes.'M'.$nbSeconds.'S';
        }

        return $result;
    }
48904
def stringify_seconds(seconds=0):
    
    seconds = int(seconds)
    minutes = seconds / 60
    ti = {'h': 0, 'm': 0, 's': 0}

    if seconds > 0:
        ti['s'] = seconds % 60
        ti['m'] = minutes % 60
        ti['h'] = minutes / 60

    return "%dh %dm %ds" % (ti['h'], ti['m'], ti['s'])
1282465
function (durationInNanoSeconds) {
        // convert it to MILLI_SECONDS
        var durationInMillis = _.floor(durationInNanoSeconds / 1000000);

        var oneMilliSecond = 1000;
        var oneMinute = 60 * oneMilliSecond;
        var formattedDuration = '0s';

        function format(min, sec, ms) {
            var MINUTES = 'm ';
            var SECONDS = 's ';
            var MILLI_SECONDS = 'ms';
            var formattedTimeStamp = '';

            min > 0 ? formattedTimeStamp += min + MINUTES : '';
            sec > 0 ? formattedTimeStamp += sec + SECONDS : '';
            ms > 0 ? formattedTimeStamp += ms + MILLI_SECONDS : '';

            return formattedTimeStamp.trim().length === 0 ? '< 1ms' : formattedTimeStamp;
        }

        if (!isNaN(durationInMillis)) {

            var min = _.floor(durationInMillis / oneMinute);
            var sec = _.floor((durationInMillis % oneMinute) / oneMilliSecond);
            var ms = durationInMillis % oneMilliSecond;

            formattedDuration = format(min, sec, ms);
        }

        return formattedDuration;
    }
1234423
def format_seconds(seconds, hide_seconds=False):
    
    if seconds <= 60:
        return str(seconds)
    output = ""
    for period, period_seconds in (
        ('y', 31557600),
        ('d', 86400),
        ('h', 3600),
        ('m', 60),
        ('s', 1),
    ):
        if seconds >= period_seconds and not (hide_seconds and period == 's'):
            output += str(int(seconds / period_seconds))
            output += period
            output += " "
            seconds = seconds % period_seconds
    return output.strip()
239845
def seconds_to_hms(input_seconds):
    """"""
    minutes, seconds = divmod(input_seconds, 60)
    hours, minutes = divmod(minutes, 60)

    hours = int(hours)
    minutes = int(minutes)
    seconds = str(int(seconds)).zfill(2)

    return hours, minutes, seconds
502031
def hours_minutes_seconds(self):
        
        minutes, seconds = symmetric_divmod(self[2], 60)
        hours, minutes = symmetric_divmod(minutes, 60)
        return hours, minutes, float(seconds) + self[3]
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)
601783
def convert_timeval(seconds_since_epoch):
    """"""
    frac, whole = math.modf(seconds_since_epoch)
    microseconds = math.floor(frac * 1000000)
    seconds = math.floor(whole)
    return seconds, microseconds
160369
def split_seconds(seconds):
    
    ms = seconds * 1000
    divisors = (1, 24, 60, 60, 1000)
    quotient, result = ms, []
    for divisor in divisors[::-1]:
        quotient, remainder = divmod(quotient, divisor)
        result.append(quotient) if divisor == 1 else result.append(remainder)
    return result[::-1]
1066820
function timeParamToSeconds(param) {
	var componentValue = function (si) {
		var regex = new RegExp('(\\d+)' + si);
		return param.match(regex) ? parseInt(RegExp.$1, 10) : 0;
	};

	return componentValue('h') * 3600
		+ componentValue('m') * 60
		+ componentValue('s');
}
808562
def ToTimedelta(self):
    """"""
    return timedelta(
        seconds=self.seconds, microseconds=_RoundTowardZero(
            self.nanos, _NANOS_PER_MICROSECOND))