Use it when you start working on the given activity. This will add the
    activity and the current time to your entries file. When you're finished,
    use the stop command.
328746
def start(ctx, alias, description, f):
    
    today = datetime.date.today()

    try:
        timesheet_collection = get_timesheet_collection_for_context(ctx, f)
    except ParseError as e:
        ctx.obj['view'].err(e)
        return

    t = timesheet_collection.latest()

    # If there's a previous entry on the same date, check if we can use its
    # end time as a start time for the newly started entry
    today_entries = t.entries.filter(date=today)
    if(today in today_entries and today_entries[today]
            and isinstance(today_entries[today][-1].duration, tuple)
            and today_entries[today][-1].duration[1] is not None):
        new_entry_start_time = today_entries[today][-1].duration[1]
    else:
        new_entry_start_time = datetime.datetime.now()

    description = ' '.join(description) if description else '?'
    duration = (new_entry_start_time, None)

    e = Entry(alias, duration, description)
    t.entries[today].append(e)
    t.save()
1088819
def add(self, index):
        
        if (index - self.flush_at) < self.interval:
            return
        now = time.time()
        elapsed = now - self.lap
        elapsed_total = now - self.start
        it = index - self.flush_at
        self.lap = now
        if self.verbose:
            logger.info("iter={} {{{}}}={}[sec/{}iter] {}[sec]".format(
                index, self.name, elapsed, it, elapsed_total))
        if self.fd is not None:
            print("{} {} {} {}".format(index, elapsed,
                                       it, elapsed_total), file=self.fd)
        self.flush_at = index
558374
public static void endDoing() {
    long elapsed = System.currentTimeMillis() - startTime;
    System.err.println("done [" + nf.format(((double) elapsed) / 1000) + 
                       " sec].");
  }
751322
public void finish(int resultCode, Intent data) {
        Activity activity = getActivity();
        activity.setResult(resultCode, data);
        activity.finish();
        setTransition(true);
    }
960071
function onActivity(e) {
      if (!_shouldActivityUpdate(e)) return;
      if (_shouldRestart()) return dispatch(context.actions.start());
      /** THIS WILL BE ROUTED TO FAST OR LOCAL STATE IF ENABLED */
      setState(_constants.IDLEMONITOR_ACTIVITY, { lastActive: +new Date(), lastEvent: { x: e.pageX, y: e.pageY } });
    }
1303525
function use (filepath, destination) {
	var startTime  = Date.now();
	var text       = read(filepath);

	if (text !== false) {
		fs.writeFile(destination, jsx(text), function (err) {
		    if (err) { throw err; }

		    var endTime = Date.now();
		    log('[Finished in ' + (endTime - startTime) + 'ms]');
		}); 
	} else {
		log('no such file exits, ' + filepath);
	}
}
728816
public void addEntry(TimerWorkItem addItem, long curTime) {
        // this routine assumes the slot is not full

        this.mostRecentlyAccessedTime = curTime;
        this.lastEntryIndex++;
        this.entries[lastEntryIndex] = addItem;
    }
1098391
private void updateTimestamps(final Entry entry) {
        // We're not differenting between an update and an edit (yet)
        entry.setUpdated(new Date());

        AppModule appModule = (AppModule) entry.getModule(AppModule.URI);
        if (appModule == null) {
            appModule = new AppModuleImpl();
            final List<Module> modules = entry.getModules() == null ? new ArrayList<Module>() : entry.getModules();
            modules.add(appModule);
            entry.setModules(modules);
        }
        appModule.setEdited(entry.getUpdated());
    }
114302
public static void starthHomeActivity(@Nullable Activity activity) {
		if (activity != null) {
			if (activity.getClass() != AbstractApplication.get().getHomeActivityClass()) {
				Intent intent = new Intent(activity, AbstractApplication.get().getHomeActivityClass());
				intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
				activity.startActivity(intent);
			}
		} else {
			LOGGER.warn("Null activity. Ignoring launch of " + AbstractApplication.get().getHomeActivityClass().getSimpleName());
		}
	}
1282556
def clean(self):
        
        active = utils.get_active_entry(self.user)
        start_time = self.cleaned_data.get('start_time', None)
        end_time = self.cleaned_data.get('end_time', None)

        if active and active.pk != self.instance.pk:
            if (start_time and start_time > active.start_time) or \
                    (end_time and end_time > active.start_time):
                raise forms.ValidationError(
                    'The start time or end time conflict with the active '
                    'entry: {activity} on {project} starting at '
                    '{start_time}.'.format(
                        project=active.project,
                        activity=active.activity,
                        start_time=active.start_time.strftime('%H:%M:%S'),
                    ))

        month_start = utils.get_month_start(start_time)
        next_month = month_start + relativedelta(months=1)
        entries = self.instance.user.timepiece_entries.filter(
            Q(status=Entry.APPROVED) | Q(status=Entry.INVOICED),
            start_time__gte=month_start,
            end_time__lt=next_month
        )
        entry = self.instance

        if not self.acting_user.is_superuser:
            if (entries.exists() and not entry.id or entry.id and entry.status == Entry.INVOICED):
                message = 'You cannot add/edit entries after a timesheet has been ' \
                    'approved or invoiced. Please correct the start and end times.'
                raise forms.ValidationError(message)

        return self.cleaned_data
783006
public function addRetry()
    {
        $retries = $this->activity['retries'];
        array_unshift($retries, Carbon::now()->toDateTimeString());
        $this->activity = array_merge($this->activity, ['retries' => $retries]);
    }
559111
private void stopActivityMonitor(){
		try {
			// Remove the monitor added during startup
			if (activityMonitor != null) {
				inst.removeMonitor(activityMonitor);
				activityMonitor = null;
			}
		} catch (Exception ignored) {}

	}
63152
public static Map.Entry<String, Map<String, ?>> currentActivityCommand() {
        return new AbstractMap.SimpleEntry<>(CURRENT_ACTIVITY, ImmutableMap.of());
    }
208551
@Override
  public void recordActivityEnd(ExecutionEntity executionEntity, String deleteReason) {
    if (isHistoryLevelAtLeast(HistoryLevel.ACTIVITY)) {
      HistoricActivityInstanceEntity historicActivityInstance = findActivityInstance(executionEntity, false, true);
      if (historicActivityInstance != null) {
        historicActivityInstance.markEnded(deleteReason);
        
        // Fire event
        ActivitiEventDispatcher activitiEventDispatcher = getEventDispatcher();
        if (activitiEventDispatcher != null && activitiEventDispatcher.isEnabled()) {
          activitiEventDispatcher.dispatchEvent(
              ActivitiEventBuilder.createEntityEvent(ActivitiEventType.HISTORIC_ACTIVITY_INSTANCE_ENDED, historicActivityInstance));
        }
      }
    }
  }
273810
private final void waitForActivityIfNotAvailable(){
		if(activityStack.isEmpty() || activityStack.peek().get() == null){

			if (activityMonitor != null) {
				Activity activity = activityMonitor.getLastActivity();
				while (activity == null){
					sleeper.sleepMini();
					activity = activityMonitor.getLastActivity();
				}
				addActivityToStack(activity);
			}
			else if(config.trackActivities){
				sleeper.sleepMini();
				setupActivityMonitor();
				waitForActivityIfNotAvailable();
			}
		}
	}
988527
@Override
	public ActivityData call() throws ActivityException {
				
		try {
			// do the real work asynchronously...
			logger.trace("activity '{}' at index {} starting", info.getActivity().getId(), index); 
			return info.getActivity().perform(info.getContext(), info.getData());
		} catch(Exception e) {
			logger.error("thread interrupted while executing task '{}' at index {}", info.getActivity().getId(), index);
			throw new ActivityException("Thread interrupted while executing task '" + info.getActivity().getId() + "' at index " + index, e);
		} finally {
			// signal that the task is complete
			logger.trace("task '{}' at index {} is complete (queue size: {})", info.getActivity().getId(), index, queue.size());
			queue.offer(index);
		}
	}
1208062
private boolean activityNeedsWait(GeneralActivity activity)
            throws ActivityException {
        if (activity instanceof SuspendableActivity)
            return ((SuspendableActivity) activity).needSuspend();
        return false;
    }