Anjay Lite
Loading...
Searching...
No Matches
time.h File Reference

Platform compatibility hooks for obtaining current time. More...

#include <anj/init.h>
#include <anj/time.h>
#include <stdint.h>

Go to the source code of this file.

Functions

anj_time_monotonic_t anj_time_monotonic_now (void)
 Returns the current monotonic time point.
 
anj_time_real_t anj_time_real_now (void)
 Returns the current real (calendar) time point.
 

Detailed Description

Platform compatibility hooks for obtaining current time.

This header declares a minimal API that platform integrators (or end users) can implement to provide current time to Anjay Lite:

The concrete implementation is platform-specific and may live in the application, BSP, or OS abstraction layer. The returned values use the same types and semantics as defined in anj/time.h.

Function Documentation

◆ anj_time_monotonic_now()

anj_time_monotonic_t anj_time_monotonic_now ( void  )

Returns the current monotonic time point.

The result is a time point measured from an arbitrary monotonic epoch (typically system boot) and must not be affected by wall-clock adjustments such as NTP sync, time zone changes, or manual edits.

Returns
anj_time_monotonic_t representing "now" on a monotonic clock.
Note
Resolution is platform-dependent. Implementations should ensure the returned value is nondecreasing across calls. Select the appropriate conversion unit when creating monotonic time structure from system time using anj_time_duration_new.
See also
anj_time_monotonic_t
anj_time_duration_t
anj_time_monotonic_new
anj_time_duration_new

◆ anj_time_real_now()

anj_time_real_t anj_time_real_now ( void  )

Returns the current real (calendar) time point.

The result is referenced to the Unix epoch (1970-01-01T00:00:00Z) and may be affected by wall-clock adjustments (NTP corrections, DST changes as reflected in local time, or manual edits).

Returns
anj_time_real_t representing "now" on the real/calendar clock.
Warning
Time synchronizations during client runtime may result in undefined behavior and are not supported.
See also
anj_time_real_t
anj_time_duration_t
anj_time_real_new
anj_time_duration_new