return days,hours,minutes and seconds
502146
def dhms(secs):
    """"""
    dhms = [0, 0, 0, 0]
    dhms[0] = int(secs // 86400)
    s = secs % 86400
    dhms[1] = int(s // 3600)
    s = secs % 3600
    dhms[2] = int(s // 60)
    s = secs % 60
    dhms[3] = int(s+.5)
    return dhms
63242
def formatDuration(self, duration):
        
        days = duration.days
        hours, remainder = divmod(duration.seconds, 3600)
        minutes, seconds = divmod(remainder, 60)
        if days:
            return '{} day{} {}h {}m {}s'.format(days, "s" if days > 1 else "",
                                                 hours, minutes, seconds)
        elif hours:
            return '{}h {}m {}s'.format(hours, minutes, seconds)
        return '{}m {}s'.format(minutes, seconds)
1312804
def number_to_day(self, day_number):
        
        return [
            calendar.day_name[6],
            calendar.day_name[0],
            calendar.day_name[1],
            calendar.day_name[2],
            calendar.day_name[3],
            calendar.day_name[4],
            calendar.day_name[5]
        ][day_number]
1288617
def multiply_by(string)
			return minute_mult(string) || hour_mult(string) || day_mult(string) || week_mult(string) || month_mult(string) || year_mult(string) || 1
		end
722405
def S(self):
    "'"
    if self.data.day in (11, 12, 13): # Special case
      return u'th'
    last = self.data.day % 10
    if last == 1:
      return u'st'
    if last == 2:
      return u'nd'
    if last == 3:
      return u'rd'
    return u'th'
641751
def duration(
    days=0,  # type: float
    seconds=0,  # type: float
    microseconds=0,  # type: float
    milliseconds=0,  # type: float
    minutes=0,  # type: float
    hours=0,  # type: float
    weeks=0,  # type: float
    years=0,  # type: float
    months=0,  # type: float
):  # type: (...) -> Duration
    
    return Duration(
        days=days,
        seconds=seconds,
        microseconds=microseconds,
        milliseconds=milliseconds,
        minutes=minutes,
        hours=hours,
        weeks=weeks,
        years=years,
        months=months,
    )
112217
def get_time_of_day_description(self):
        
        seconds_expression = self._expression_parts[0]
        minute_expression = self._expression_parts[1]
        hour_expression = self._expression_parts[2]

        description = StringBuilder()

        # handle special cases first
        if any(exp in minute_expression for exp in self._special_characters) is False and \
            any(exp in hour_expression for exp in self._special_characters) is False and \
                any(exp in seconds_expression for exp in self._special_characters) is False:
            # specific time of day (i.e. 10 14)
            description.append(_("At "))
            description.append(
                self.format_time(
                    hour_expression,
                    minute_expression,
                    seconds_expression))
        elif "-" in minute_expression and \
            "," not in minute_expression and \
                any(exp in hour_expression for exp in self._special_characters) is False:
            # minute range in single hour (i.e. 0-10 11)
            minute_parts = minute_expression.split('-')
            description.append(_("Every minute between {0} and {1}").format(
                self.format_time(hour_expression, minute_parts[0]), self.format_time(hour_expression, minute_parts[1])))
        elif "," in hour_expression and "-" not in hour_expression and \
                any(exp in minute_expression for exp in self._special_characters) is False:
            # hours list with single minute (o.e. 30 6,14,16)
            hour_parts = hour_expression.split(',')
            description.append(_("At"))
            for i, hour_part in enumerate(hour_parts):
                description.append(" ")
                description.append(
                    self.format_time(hour_part, minute_expression))

                if i < (len(hour_parts) - 2):
                    description.append(",")

                if i == len(hour_parts) - 2:
                    description.append(_(" and"))
        else:
            # default time description
            seconds_description = self.get_seconds_description()
            minutes_description = self.get_minutes_description()
            hours_description = self.get_hours_description()

            description.append(seconds_description)

            if description:
                description.append(", ")

            description.append(minutes_description)

            if description:
                description.append(", ")

            description.append(hours_description)
        return str(description)
378013
def format_time(time_string):
    '''
    
    '''
    subseconds = False
    data = time_string.split("_")
    hours, minutes, seconds = int(data[3]), int(data[4]), int(data[5])
    date = datetime.datetime.strptime("_".join(data[:3]), "%Y_%m_%d")
    subsec = 0.0
    if len(data) == 7:
        if float(data[6]) != 0:
            subsec = float(data[6]) / 10**len(data[6])
            subseconds = True
    date_time = date + \
        datetime.timedelta(hours=hours, minutes=minutes,
                           seconds=seconds + subsec)
    return date_time, subseconds
392156
def format_time_large(seconds):
    

    if not isinstance(seconds, (int, float)):
        return str(seconds)

    if math.isnan(seconds):
        return "-"

    seconds = int(round(seconds))
    if abs(seconds)<60:
        return "{:d}".format(seconds)
    else:
        minutes = int(seconds/60)
        seconds %= 60
        if abs(minutes)<60:
            return "{:d}:{:02d}".format(minutes,seconds)
        else:
            hours = int(minutes/60)
            minutes %= 60
            if abs(hours)<24:
                return "{:d}:{:02d}:{:02d}".format(hours,minutes,seconds)
            else:
                days = int(hours/24)
                hours %= 24
                return "{:d}:{:02d}:{:02d}:{:02d}".format(
                    days,hours,minutes,seconds)
584920
def datetimes(self):
        """"""
        if self.timestep == 1:
            return tuple(dt.add_minute(30) for dt in
                         self.direct_normal_irradiance.datetimes)
        else:
            return self.direct_normal_irradiance.datetimes
1057898
function relativeParts (seconds) {
        seconds = Math.abs(seconds);
        var descriptors = {};
        var units = [
            'years', 86400 * 365,
            'months', 86400 * 30,
            'weeks', 86400 * 7,
            'days', 86400,
            'hours', 3600,
            'minutes', 60
        ];

        if (seconds < 60) {
            return {
                minutes: Math.round(seconds / 60)
            };
        }

        for (var i = 0, uLen = units.length; i < uLen; i += 2) {
            var value = units[i + 1];
            if (seconds >= value) {
                descriptors[units[i]] = Math.floor(seconds / value);
                seconds -= descriptors[units[i]] * value;
            }
        }
        return descriptors;
    }
1033289
def humanTime(seconds):
  '''
  
  '''
  intervals = ['days', 'hours', 'minutes', 'seconds']
  x = deltaTime(seconds=seconds)
  return ' '.join('{} {}'.format(getattr(x, k), k) for k in intervals if getattr(x, k))
432626
function () {
        var day, hour, minute, second,
            gapTime = this._finishTime - ( this._beginTime += this.DELAY );

        if ( gapTime <= 0 ) {
            return {_gap: 0, day: 0, hour: 0, minute: 0, second: 0};
        } else {
            day = Math.floor( gapTime / 1000 / 60 / 60 / 24 );
            hour = Math.floor( gapTime / 1000 / 60 / 60 - (24 * day) );
            minute = Math.floor( gapTime / 1000 / 60 - (24 * 60 * day ) - (60 * hour) );
            second = Math.floor( gapTime / 1000 - (24 * 60 * 60 * day) - (60 * 60 * hour) - (60 * minute) );
            return {_gap: gapTime, day: day, hour: hour, minute: minute, second: second};
        }
    }
805693
def format_timedelta(dt: timedelta) -> str:
    
    seconds = int(dt.total_seconds())
    days, remainder = divmod(seconds, 86400)
    hours, remainder = divmod(remainder, 3600)
    minutes, seconds = divmod(remainder, 60)
    s = ""
    if days > 0:
        s += str(days) + "d"
    if hours > 0:
        s += str(hours) + "h"
    if minutes > 0:
        s += str(minutes) + "min"
    if s == "":
        s = "0min"
    return s
880366
def Timestamp(year, month, day, hour, minute, second):
    """"""
    return datetime.datetime(year, month, day, hour, minute, second)
1136665
def _times(t0, hours):
		
		if not isinstance(hours, Iterable):
			return Tide._times(t0, [hours])[0]
		elif not isinstance(hours[0], datetime):
			return np.array([t0 + timedelta(hours=h) for h in hours])
		else:
			return np.array(hours)
367668
def get_times(self):
        """"""
        if not self.n:
            return []
        self.times = list(mul(self.u1, self.t1)) + \
            list(mul(self.u2, self.t2)) + \
            list(mul(self.u3, self.t3)) + \
            list(mul(self.u4, self.t4))

        self.times = matrix(list(set(self.times)))
        self.times = list(self.times) + list(self.times - 1e-6)
        return self.times