Determines when has this process finished running.
        If the process is still alive, the current time is returned instead.

        @rtype:  win32.SYSTEMTIME
        @return: Process exit time.
338248
def get_exit_time(self):
        
        if self.is_alive():
            ExitTime = win32.GetSystemTimeAsFileTime()
        else:
            if win32.PROCESS_ALL_ACCESS == win32.PROCESS_ALL_ACCESS_VISTA:
                dwAccess = win32.PROCESS_QUERY_LIMITED_INFORMATION
            else:
                dwAccess = win32.PROCESS_QUERY_INFORMATION
            hProcess = self.get_handle(dwAccess)
            ExitTime = win32.GetProcessTimes(hProcess)[1]
        return win32.FileTimeToSystemTime(ExitTime)
404908
public long getCompletionTime()
  {
    
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
      SibTr.entry(tc, "getCompletionTime");
    
    long completionTime =-1;
    //only calculate if the timeout is not infinite
    long timeOut = getTimeout();
    if(timeOut != SIMPConstants.INFINITE_TIMEOUT) 
    {
      completionTime = getIssueTime() + timeOut;  
    }
    
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())      
      SibTr.exit(tc, "getCompletionTime", new Long(completionTime));
    
    return completionTime;    
  }
743034
def _client_run(self):
        
        self._connection.work()
        now = self._counter.get_current_ms()
        if self._last_activity_timestamp and not self._was_message_received:
            # If no messages are coming through, back off a little to keep CPU use low.
            time.sleep(0.05)
            if self._timeout > 0:
                timespan = now - self._last_activity_timestamp
                if timespan >= self._timeout:
                    _logger.info("Timeout reached, closing receiver.")
                    self._shutdown = True
        else:
            self._last_activity_timestamp = now
        self._was_message_received = False
        return True
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()
709101
def is_alive(self):
        

        if self.exit_code is not None:
            return False, self.exit_code

        # what we're doing here essentially is making sure that the main thread
        # (or another thread), isn't calling .wait() on the process.  because
        # .wait() calls os.waitpid(self.pid, 0), we can't do an os.waitpid
        # here...because if we did, and the process exited while in this
        # thread, the main thread's os.waitpid(self.pid, 0) would raise OSError
        # (because the process ended in another thread).
        #
        # so essentially what we're doing is, using this lock, checking if
        # we're calling .wait(), and if we are, let .wait() get the exit code
        # and handle the status, otherwise let us do it.
        acquired = self._wait_lock.acquire(False)
        if not acquired:
            if self.exit_code is not None:
                return False, self.exit_code
            return True, self.exit_code

        try:
            # WNOHANG is just that...we're calling waitpid without hanging...
            # essentially polling the process.  the return result is (0, 0) if
            # there's no process status, so we check that pid == self.pid below
            # in order to determine how to proceed
            pid, exit_code = no_interrupt(os.waitpid, self.pid, os.WNOHANG)
            if pid == self.pid:
                self.exit_code = handle_process_exit_code(exit_code)
                self._process_just_ended()

                return False, self.exit_code

        # no child process
        except OSError:
            return False, self.exit_code
        else:
            return True, self.exit_code
        finally:
            self._wait_lock.release()
891045
public long done() {
    if (enabled) {
      if (!done) {
        lastCheckpointNanos = System.nanoTime();
        done = true;
      }
      return lastCheckpointNanos - startNanos;
    }
    return -1;
  }
683821
def _finish(self):
        
        if self.active and self.cnt >= self.max_iter:
            self.total_time = self._elapsed()
            self.end = time.time()
            self.last_progress -= 1  # to force a refreshed _print()
            self._print()
            if self.track:
                self._stream_out('\nTotal time elapsed: ' +
                                 self._get_time(self.total_time))
            self._stream_out('\n')
            self.active = False
426575
def get_end_time(self):
        
        end_time = c_double()
        self.library.get_end_time.argtypes = [POINTER(c_double)]
        self.library.get_end_time.restype = None
        self.library.get_end_time(byref(end_time))
        return end_time.value
1036011
def exitcode(self):
        
        if self._process is None:
            raise ProcessError(
                "Process '%s' has not been started yet" % self.name)
        return self._process.exitcode
1054948
def finish(self):
        ''

        self.finished = True
        self.update(self.maxval)
        self.fd.write('\n')
        if self.signal_set:
            signal.signal(signal.SIGWINCH, signal.SIG_DFL)

        if self.redirect_stderr:
            self._stderr.write(sys.stderr.getvalue())
            sys.stderr = self._stderr

        if self.redirect_stdout:
            self._stdout.write(sys.stdout.getvalue())
            sys.stdout = self._stdout
910469
def get_process(self):
        
        pid     = self.get_pid()
        system  = self.debug.system
        if system.has_process(pid):
            process = system.get_process(pid)
        else:
            # XXX HACK
            # The process object was missing for some reason, so make a new one.
            process = Process(pid)
            system._add_process(process)
##            process.scan_threads()    # not needed
            process.scan_modules()
        return process
119105
def elapsed(self):
        
        if self._stop is None:
            return timer() - self._start
        return self._stop - self._start
653927
def is_at_exit():
    
    if _threading_main_thread is not None:
        if not hasattr(threading, "main_thread"):
            return True
        if threading.main_thread() != _threading_main_thread:
            return True
        if not _threading_main_thread.is_alive():
            return True
    return False
69718
public boolean isFinished()
	{
		if (finished)
			return true;

		try
		{
			final int code = exitCode();

			finished(code);

			return true;
		}
		catch (IllegalThreadStateException e)
		{
			return false;
		}
	}
505147
def is_running(self):
        

        if self._process:
            if self._process.returncode is None:
                return True
            else:
                self._process = None
        return False
184090
public boolean isRunning() {

        if (m_lastLogErrorTime <= 0) {
            m_lastLogErrorTime = System.currentTimeMillis();
            m_lastLogWarnTime = m_lastLogErrorTime;
        } else {
            long currentTime = System.currentTimeMillis();
            if ((currentTime - m_lastLogWarnTime) > 30000) {
                // write warning to log after 30 seconds
                if (LOG.isWarnEnabled()) {
                    LOG.warn(
                        Messages.get().getBundle().key(
                            Messages.LOG_WAITING_ABANDONED_THREADS_2,
                            new Integer(m_abandonedCounter),
                            new Integer((m_startedCounter - m_returnedCounter))));
                }
                m_lastLogWarnTime = currentTime;
            }
            if ((currentTime - m_lastLogErrorTime) > 600000) {
                // write error to log after 10 minutes
                LOG.error(
                    Messages.get().getBundle().key(
                        Messages.LOG_WAITING_ABANDONED_THREADS_2,
                        new Integer(m_abandonedCounter),
                        new Integer((m_startedCounter - m_returnedCounter))));
                m_lastLogErrorTime = currentTime;
            }
        }

        boolean result = (m_returnedCounter + m_abandonedCounter) < m_startedCounter;
        if (result && LOG.isInfoEnabled()) {
            // write a note to the log that all threads have finished
            LOG.info(Messages.get().getBundle().key(Messages.LOG_THREADS_FINISHED_0));
        }
        return result;
    }
427985
def calc_finished(self):
        '''
        
        '''
        #print_stack(limit=5)
        if not self.calc_running :
            #print('Calc running:',self.calc_running)
            return True
        else:
            # The calc is marked as running check if this is still true
            # We do it by external scripts. You need to write these
            # scripts for your own system.
            # See examples/scripts directory for examples.
            with work_dir(self.working_dir) :
                o=check_output(['check-job'])
            #print('Status',o)
            if o[0] in b'R' :
                # Still running - we do nothing to preserve the state
                return False
            else :
                # The job is not running maybe it finished maybe crashed
                # We hope for the best at this point ad pass to the
                # Standard update function
                return True