Skip to content

Date/Time

System Date&Time functions.

These functions are used to set the date and time base of the operating system based on UTC second-based unix timestamps. The function osSetSystemTime (uint32_t sec) will much likely never be called by a user of the API, unless the system time needs to be entered via some kind of user-interface, because the TCP/IP subsystem will try to retreive the time via NTP as soon as any network interface goes up. Please be aware, that currently there is no way to prevent the system from updateing the time via NTP itself, whenever there is an internet connection available.

Functions Overview

Name
uint32_tosKernelGetTickCount(void )
Get the RTOS kernel tick count.
uint32_tosKernelGetTickFreq(void )
Get the RTOS kernel tick frequency.
voidosSetSystemTime(uint32_t sec)
Set the systems date/time base.

Function Details

function osKernelGetTickCount

cpp
uint32_t osKernelGetTickCount(
    void 
)

Get the RTOS kernel tick count.

Return: RTOS kernel current tick count.

function osKernelGetTickFreq

cpp
uint32_t osKernelGetTickFreq(
    void 
)

Get the RTOS kernel tick frequency.

Return: frequency of the kernel tick in hertz, i.e. kernel ticks per second.

function osSetSystemTime

cpp
void osSetSystemTime(
    uint32_t sec
)

Set the systems date/time base.

Parameters:

  • sec the system timebase in seconds as Unix-Timestamp

call this function only in situations where there are no network interfaces with an IP-Connection to the internet are available, because the OS will utilize NTP to set its timebase automatically when possible. The function is only made avaiable in the public API for applications that don't have network interfaces and need to set a time and date manually via some user interface.