Time & Timer Functions

Download the inPulse SDK
/**
 * Main Timer
 *
 * Simulator status: Implemented
 *
 * @return the time in milliseconds since the processor last dozed (or since boot)
 */

uint32_t pulse_get_millis();

/**
 * Getting the date and time
 *
 * Note: basic date and time information will be populated but anything related to
 *       timezone may not be.
 *
 * Simulator status: Implemented
 *
 * @param tm The struct to be populated with the date and time
 */

void pulse_get_time_date(struct pulse_time_tm *ts);

/**
 * Registers a callback to be notified when at least "timeout" milliseconds elapse
 * with a certain data pointer. An id is returned for this particular registration
 * to be used with pulse_cancel_timer if cancelling a callback is desired.
 *
 * Timers will only expire and callbacks will only be called while the app is
 * waiting for pulse_get_event to return. Apps don't worry about being interupted
 * by a callback when they're doing other operations.
 *
 * Simulator status: Implemented
 *
 * @param timeout The number of milliseconds the timer will fire after.
 * @param callback The function pointer that gets called after the timer expires.
 * @param data A cookie that will be passed to the callback function as a parameter.
 *
 * @return A unique ID that can be used to cancel the timer later or -1 if timer
 *         can't be registered.
 */

int32_t pulse_register_timer(uint32_t timeout_ms, PulseCallback callback, void *data);

/**
 * Cancelling a timer
 * Note: the int32_t passed in is set to -1 after the timer is cancelled.
 *
 * Simulator status: Implemented
 *
 * @param id The timer ID returned from pulse_register_timer
 *
 */

void pulse_cancel_timer(int32_t * id);