Skip to content

Clock library

Defines

CLOCK_SECOND

#define CLOCK_SECOND

A second measured in system clock time.

Types

clock_time_t

typedef uint32_t clock_time_t;

clock_interval_t

typedef int32_t clock_interval_t;

Functions

clock_time

clock_time_t clock_time(void);

Get the current clock time.

This function returns the current system clock time.

Return value

The current clock time, measured in system ticks.

clock_diff

clock_interval_t clock_diff(clock_time_t time_a, clock_time_t time_b);

Calculate the duration between two timestamps.

This function calculates and returns the number of system ticks between two timestamps.

Parameters

Name Description
time_a The first timestamp.
time_b The second timestamp.

Return value

Number of system ticks between two timestamps.

clock_seconds

unsigned long clock_seconds(void);

Get the current value of system clock in seconds.

This function retrieves the current value of clock, which could be the number of seconds since startup or since a standard epoch.

Return value

The current value of system clock in seconds.

Back to top