ENTS-tock
Environmental NeTworked Sensor firmware on Tock OS
Loading...
Searching...
No Matches
Utilities
uint32_t epoch (void)
 Gets the current unix epoch timestamp.
 
void set_epoch (uint32_t epoch)
 Sets the current unix epoch timestamp.
 
uint32_t rtc_date_to_epoch (const libtock_rtc_date_t *date)
 Converts tock time to unix epoch time.
 
void epoch_to_rtc_date (uint32_t epoch, libtock_rtc_date_t *date)
 Convert unix epoch to tock time.
 

Detailed Description

Small shared helpers that are not tied to any one peripheral.

Function Documentation

◆ epoch()

uint32_t epoch ( void  )

Gets the current unix epoch timestamp.

See also
rtc_date_to_epoch
Returns
Unix epochs.

Definition at line 19 of file time.c.

References rtc_date_to_epoch().

Referenced by ControllerMicroSDUserConfig(), epoch_to_rtc_date(), measure_sensor(), set_epoch(), test_epoch_to_rtc_date(), test_rtc_date_to_epoch(), and test_time_epoch().

◆ epoch_to_rtc_date()

void epoch_to_rtc_date ( uint32_t  epoch,
libtock_rtc_date_t *  date 
)

Convert unix epoch to tock time.

Parameters
epochInput epoch.
dateOutput date

Definition at line 65 of file time.c.

References epoch().

Referenced by set_epoch(), and test_epoch_to_rtc_date().

◆ rtc_date_to_epoch()

uint32_t rtc_date_to_epoch ( const libtock_rtc_date_t *  date)

Converts tock time to unix epoch time.

Parameters
datePointer to date struct.
Returns
Unix epoch time.

Definition at line 31 of file time.c.

Referenced by epoch(), and test_rtc_date_to_epoch().

◆ set_epoch()

void set_epoch ( uint32_t  epoch)

Sets the current unix epoch timestamp.

See also
epoch_to_rtc_date
Parameters
epochUnix epoch.

Definition at line 25 of file time.c.

References epoch(), and epoch_to_rtc_date().

Referenced by lorawan_timesync(), and test_time_epoch().