Calculates the duration of the given CumulativeData in seconds.
6560
private static double getDurationInSecs(
      ViewData.AggregationWindowData.CumulativeData cumulativeData) {
    return toDoubleSeconds(cumulativeData.getEnd().subtractTimestamp(cumulativeData.getStart()));
  }
852022
def seconds
      @seconds ||= duration.split(':').collect(&:to_i).reverse.
        inject([1, 0]) { |(m, sum), i| [m * 60, sum + i * m] }.last
    end
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,
    )
1067847
def _calculate_fake_duration():
    '''
    
    '''
    utc_start_time = datetime.datetime.utcnow()
    local_start_time = utc_start_time - \
        (datetime.datetime.utcnow() - datetime.datetime.now())
    utc_finish_time = datetime.datetime.utcnow()
    start_time = local_start_time.time().isoformat()
    delta = (utc_finish_time - utc_start_time)
    # duration in milliseconds.microseconds
    duration = (delta.seconds * 1000000 + delta.microseconds) / 1000.0

    return start_time, duration
533490
def timedelta_seconds(timedelta):
    """"""
    return (timedelta.total_seconds() if hasattr(timedelta, "total_seconds")
            else timedelta.days * 24 * 3600 + timedelta.seconds +
                 timedelta.microseconds / 1000000.)
1028372
function(mod) {
			var seconds = this.getTimeSeconds();
			
			if(mod) {
				if(seconds == 60) {
					seconds = 0;
				}
				else {
					seconds = seconds % 60;
				}
			}
			
			return Math.ceil(seconds);
		}
575357
def _duration(self):
        """"""
        duration = 0
        if self.state != STATE_IDLE:
            resp = self._player.query_duration(_FORMAT_TIME)
            duration = resp[1] // _NANOSEC_MULT
        return duration
1333709
def cumulative_gaps_to(self,
                           when: datetime.datetime) -> datetime.timedelta:
        
        gaps = self.gaps()
        return gaps.cumulative_time_to(when)
309203
private Double getDuration(Duration duration)
   {
      Double result;
      if (duration == null)
      {
         result = null;
      }
      else
      {
         if (duration.getUnits() != TimeUnit.HOURS)
         {
            duration = duration.convertUnits(TimeUnit.HOURS, m_projectFile.getProjectProperties());
         }

         result = Double.valueOf(duration.getDuration());
      }
      return result;
   }
576443
function timeDiff(newest, oldest) {
  var diff = (parseFloat(newest) - parseFloat(oldest));
  if (diff < 0) {
    diff = ((10000 + parseFloat(newest)) - parseFloat(oldest));
  }
  return diff;
}
100310
def half_duration(self):
        """"""
        if self._interval is not None:
            a, b = self._interval
            return (b - a) * .5
        else:
            return self.interval_duration * .5
1314999
def timeit(self, metric, func, *args, **kwargs):
        
        (res, seconds) = timeit(func, *args, **kwargs)
        self.timing(metric, seconds * 1000.0)
        return res
699013
def ToMilliseconds(self):
    """"""
    millis = _RoundTowardZero(self.nanos, _NANOS_PER_MILLISECOND)
    return self.seconds * _MILLIS_PER_SECOND + millis
220680
def timesince(self, when):
        
        units = (
            ("year",   60 * 60 * 24 * 365),
            ("week",   60 * 60 * 24 * 7),
            ("day",    60 * 60 * 24),
            ("hour",   60 * 60),
            ("minute", 60),
            ("second", 1),
        )
        delta = datetime.now() - when
        total_seconds = delta.days * 60 * 60 * 24 + delta.seconds
        parts = []
        for name, seconds in units:
            value = total_seconds / seconds
            if value > 0:
                total_seconds %= seconds
                s = "s" if value != 1 else ""
                parts.append("%s %s%s" % (value, name, s))
        return " and ".join(", ".join(parts).rsplit(", ", 1))
710583
def fromseconds(cls, seconds):
        """"""
        try:
            seconds = int(seconds)
        except TypeError:
            seconds = int(seconds.flatten()[0])
        return cls(datetime.timedelta(0, int(seconds)))
90556
def _elapsed_time(begin_time, end_time):
    

    bt = _str2datetime(begin_time)
    et = _str2datetime(end_time)

    return float((et - bt).seconds)
212064
def total_duration(self) -> datetime.timedelta:
        
        total = datetime.timedelta()
        for interval in self.intervals:
            total += interval.duration()
        return total