/** * \internal * * \brief This function changes the description of the current task that the * \p timer describes. * * Sets a new name - \p state_name - for the current "phase" of the operation, * and calls ped_timer_touch(). */ void ped_timer_set_state_name (PedTimer* timer, const char* state_name) { if (!timer) return; timer->state_name = state_name; ped_timer_touch (timer); }
/** * \internal * * \brief This function sets the \p timer into a "start of task" position. * * It resets the \p timer, by setting \p timer->start and \p timer->now * to the current time. */ void ped_timer_reset (PedTimer* timer) { if (!timer) return; timer->start = timer->now = timer->predicted_end = time (NULL); timer->state_name = NULL; timer->frac = 0; ped_timer_touch (timer); }
PyObject *py_ped_timer_touch(PyObject *s, PyObject *args) { PedTimer *timer = NULL; timer = _ped_Timer2PedTimer(s); if (timer == NULL) { return NULL; } ped_timer_touch(timer); ped_timer_destroy(timer); Py_INCREF(Py_None); return Py_None; }
/** * \internal * * \brief This function tells a \p timer what fraction \p frac of the task * has been completed. * * Sets the new \p timer->frac, and calls ped_timer_touch(). */ void ped_timer_update (PedTimer* timer, float frac) { if (!timer) return; timer->now = time (NULL); timer->frac = frac; if (frac) timer->predicted_end = timer->start + (long) ((timer->now - timer->start) / frac); ped_timer_touch (timer); }