BSB Developer Docs
Loading...
Searching...
No Matches
time.h File Reference

TIME (Simple Network Time Protocol) service API. More...

#include "settings/settings.h"
#include <datetime.h>

Go to the source code of this file.

Macros

#define RECORD_TIME   "time"
 Record name for Time service.
 

Typedefs

typedef struct Time Time
 Time service opaque type declaration.
 

Functions

void time_get_settings (const Time *instance, TimeSettings *settings)
 Get the current time settings.
 
bool time_set_settings (Time *instance, const TimeSettings *settings)
 Set new time settings.
 
time_t time_get_timestamp (void)
 Get Unix seconds timestamp.
 
LocalTime time_get_local_time (Time *instance)
 Get date, time, and timezone offset in local timezone.
 
time_t time_get_timestamp_ms (void)
 Get Unix milliseconds timestamp.
 
FuriState * time_get_settings_state (Time *instance)
 Get FuriState holding TimeSettings.
 

Detailed Description

TIME (Simple Network Time Protocol) service API.

Function Documentation

◆ time_get_local_time()

LocalTime time_get_local_time ( Time * instance)

Get date, time, and timezone offset in local timezone.

Parameters
[in]instance
Returns
local DateTime

◆ time_get_settings()

void time_get_settings ( const Time * instance,
TimeSettings * settings )

Get the current time settings.

Retrieves the current configuration of the Time service including server address, timezone offset, sync interval, and enabled state.

Parameters
[in]instancepointer to the Time service instance
[out]settingspointer to a structure to be filled with current settings

◆ time_get_settings_state()

FuriState * time_get_settings_state ( Time * instance)

Get FuriState holding TimeSettings.

Parameters
[in]instance

◆ time_get_timestamp()

time_t time_get_timestamp ( void )

Get Unix seconds timestamp.

Returns
64-bit Unix seconds timestamp

◆ time_get_timestamp_ms()

time_t time_get_timestamp_ms ( void )

Get Unix milliseconds timestamp.

Returns
64-bit Unix milliseconds timestamp

◆ time_set_settings()

bool time_set_settings ( Time * instance,
const TimeSettings * settings )

Set new time settings.

Updates the Time service configuration. Changes take effect immediately and will trigger a reconfiguration of the background synchronization task if the service is enabled.

Parameters
[in,out]instancepointer to the Time service instance
[in]settingspointer to a structure containing the new settings
Returns
true if settings were successfully applied, false otherwise