Provided an issue or a start datetime, will return the cycle time since the start or progress
968497
def get_cycle_time(self, issue_or_start_or_key):
        
        if isinstance(issue_or_start_or_key, basestring):
            issue_or_start_or_key = self.get_issue(issue_or_start_or_key)

        if isinstance(issue_or_start_or_key, jira.resources.Issue):
            progress_started = self.get_datetime_issue_in_progress(issue_or_start_or_key)
        elif isinstance(issue_or_start_or_key, datetime.datetime):
            progress_started = issue_or_start_or_key

        curr_time = datetime.datetime.now(dateutil.tz.tzlocal())
        return utils.working_cycletime(progress_started, curr_time)
727861
def status(self):
        
        myNow = timezone.localtime(timezone=self.tz)
        daysDelta = dt.timedelta(days=self.num_days - 1)
        # NB: postponements can be created after the until date
        #     so ignore that
        todayStart = getAwareDatetime(myNow.date(), dt.time.min, self.tz)
        eventStart, event = self.__afterOrPostponedTo(todayStart - daysDelta)
        if eventStart is None:
            return "finished"
        eventFinish = getAwareDatetime(eventStart.date() + daysDelta,
                                       event.time_to, self.tz)
        if event.time_from is None:
            eventStart += _1day
        if eventStart < myNow < eventFinish:
            # if there are two occurences on the same day then we may miss
            # that one of them has started
            return "started"
        if (self.repeat.until and eventFinish < myNow and
            self.__afterOrPostponedTo(myNow)[0] is None):
            # only just wound up, the last occurence was earlier today
            return "finished"
876442
public long getIssueTime()
  {
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) 
      SibTr.entry(tc, "getIssueTime");
      
    long issueTime = aiRequestedTick.getIssueTime();
    
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) 
      SibTr.exit(tc, "getIssueTime", new Long(issueTime));
    return issueTime;
  }
713388
def get_timedelta(self, now=None):
        
        def datetime_to_time(timestamp):
            atime = time.mktime(timestamp.timetuple())
            atime += timestamp.microsecond / 10.0**6
            return atime
        if self.started is not None:
            now = now or datetime.datetime.now()
            started_time = datetime_to_time(self.started)
            now_time = datetime_to_time(now)
            return now_time - started_time
        return None
482082
def get(self):
        
        now = datetime.now()
        if self._start_time:
            if self._stop_time:
                return (self._stop_time - self._start_time).total_seconds()
            return (now - self._start_time).total_seconds()
        return 0.
380071
def timeframe(self, start, end):
        
        """
        if start:
            self._time_frame['chfieldfrom'] = start
        if end:
            self._time_frame['chfieldto'] = end
        return self
158276
def get_time(self, loc4d=None):
        
        if loc4d is None:
            raise ValueError("Location4D object can not be None")

        if self.pattern == self.PATTERN_CYCLE:
            c = SunCycles.cycles(loc=loc4d)
            if self.cycle == self.CYCLE_SUNRISE:
                r = c[SunCycles.RISING]
            elif self.cycle == self.CYCLE_SUNSET:
                r = c[SunCycles.SETTING]
            td = timedelta(hours=self.time_delta)
            if self.plus_or_minus == self.HOURS_PLUS:
                r = r + td
            elif self.plus_or_minus == self.HOURS_MINUS:
                r = r - td
            return r
        elif self.pattern == self.PATTERN_SPECIFICTIME:
            return self._time.replace(year=loc4d.time.year, month=loc4d.time.month, day=loc4d.time.day)
153780
def update_progress(cls, progress, starttime):
        
        width, _height = click.get_terminal_size()
        if not width:
            return

        duration = datetime.utcnow() - starttime
        hours, remainder = divmod(duration.seconds, 3600)
        minutes, seconds = divmod(remainder, 60)

        size = int(width * .6)
        status = ""
        if isinstance(progress, int):
            progress = float(progress)
        if not isinstance(progress, float):
            progress = 0
            status = 'error: progress var must be float\n'
            cls.echo(type(progress))
        if progress < 0:
            progress = 0
            status = 'Halt...\n'
        if progress >= 1:
            progress = 1
            # status = 'Done...\n'
        block = int(round(size * progress))
        text = ('\rProgress: [{0}] {1:.2%} {2} {3:0>2}:{4:0>2}:{5:0>2}  '
                ''.format('#' * block + '-' * (size - block), progress,
                          status, hours, minutes, seconds))
        sys.stdout.write(text)
        sys.stdout.flush()
739594
def request_time(self) -> float:
        """"""
        if self._finish_time is None:
            return time.time() - self._start_time
        else:
            return self._finish_time - self._start_time
503511
def clean_start_time(self):
        
        start = self.cleaned_data.get('start_time')
        if not start:
            return start
        active_entries = self.user.timepiece_entries.filter(
            start_time__gte=start, end_time__isnull=True)
        for entry in active_entries:
            output = ('The start time is on or before the current entry: '
                      '%s - %s starting at %s' % (entry.project, entry.activity,
                                                  entry.start_time.strftime('%H:%M:%S')))
            raise forms.ValidationError(output)
        return start
1333709
def cumulative_gaps_to(self,
                           when: datetime.datetime) -> datetime.timedelta:
        
        gaps = self.gaps()
        return gaps.cumulative_time_to(when)
877108
def start(self) -> pd.Timestamp:
        """"""
        start = self.data.timestamp.min()
        self.data = self.data.assign(start=start)
        return start
1153449
def previous_occurrence(from)
      from = TimeUtil.match_zone(from, start_time) or raise ArgumentError, "Time required, got #{from.inspect}"
      return nil if from <= start_time
      enumerate_occurrences(start_time, from - 1).to_a.last
    end
1016831
def remaining_time(self):
        
        elapsed_time = (datetime.datetime.now() - self.start_time).total_seconds()
        # safety to avoid devision by zero
        if self.progress == 0:
            self.progress = 1

        estimated_total_time = 100. / self.progress * elapsed_time

        return datetime.timedelta(seconds = max(estimated_total_time - elapsed_time, 0))
922215
def _getAbsoluteTime(self, start, delay):
        
        return start + datetime.timedelta(days=0, seconds=delay)
737383
def get_time_spent(self):
        
        # Take another look at this. Not sure it's correct:
        if not self.has_started or not self.has_ended():
            raise errors.IllegalState()
        if self._my_map['completionTime'] is not None:
            return self.get_completion_time() - self.get_actual_start_time()
        else:
            raise errors.IllegalState()
1241123
def start_datetime(self) -> Optional[datetime.datetime]:
        
        if not self.intervals:
            return None
        return self.intervals[0].start