#include <stdint.h>
#include <stdlib.h>
Go to the source code of this file.
|
uint32_t | TIME_get_current_system_uptime_ms (void) |
|
void | TIME_set_current_unix_epoch_time_ms (uint64_t current_unix_epoch_time_ms, TIME_sync_source_enum_t source) |
| Use this function in a telecommand, or upon receiving a time update from the GNSS.
|
|
uint64_t | TIME_get_current_unix_epoch_time_ms () |
| Returns the current unix timestamp, in milliseconds.
|
|
uint64_t | TIME_convert_uptime_to_unix_epoch_time_ms (uint32_t uptime_ms) |
| Convert the system uptime to a unix epoch time in ms.
|
|
void | TIME_format_timestamp_str (char dest_str[], size_t dest_str_size, uint32_t uptime_ms, TIME_sync_source_enum_t sync_source) |
|
void | TIME_get_current_timestamp_str (char *dest_str, size_t dest_str_size) |
| Returns a computer-friendly timestamp string.
|
|
void | TIME_format_utc_datetime_str (char *dest_str, size_t dest_str_size, uint64_t timestamp_ms, TIME_sync_source_enum_t sync_source) |
|
void | TIME_get_current_utc_datetime_str (char *dest_str, size_t dest_str_size) |
|
char | TIME_sync_source_enum_to_letter_char (TIME_sync_source_enum_t source) |
|
◆ TIME_EPOCH_DECIMAL_STRING_LEN
#define TIME_EPOCH_DECIMAL_STRING_LEN 13 |
◆ TIME_sync_source_enum_t
Enumerator |
---|
TIME_SYNC_SOURCE_NONE | |
TIME_SYNC_SOURCE_GNSS | |
TIME_SYNC_SOURCE_TELECOMMAND_ABSOLUTE | |
TIME_SYNC_SOURCE_TELECOMMAND_CORRECTION | |
TIME_SYNC_SOURCE_EPS_RTC | |
◆ TIME_convert_uptime_to_unix_epoch_time_ms()
uint64_t TIME_convert_uptime_to_unix_epoch_time_ms |
( |
uint32_t | uptime_ms | ) |
|
Convert the system uptime to a unix epoch time in ms.
- Parameters
-
uptime_ms | System uptime in ms, as returned by HAL_GetTick(). |
- Returns
- The unix epoch time in ms (ms since 1970-01-01).
- Note
- This function still works fine even if you store the uptime, resync the system time, and then call this function.
◆ TIME_format_timestamp_str()
void TIME_format_timestamp_str |
( |
char | dest_str[], |
|
|
size_t | dest_str_size, |
|
|
uint32_t | uptime_ms, |
|
|
TIME_sync_source_enum_t | sync_source ) |
◆ TIME_format_utc_datetime_str()
void TIME_format_utc_datetime_str |
( |
char * | dest_str, |
|
|
size_t | dest_str_size, |
|
|
uint64_t | timestamp_ms, |
|
|
TIME_sync_source_enum_t | sync_source ) |
◆ TIME_get_current_system_uptime_ms()
uint32_t TIME_get_current_system_uptime_ms |
( |
void | | ) |
|
◆ TIME_get_current_timestamp_str()
void TIME_get_current_timestamp_str |
( |
char * | dest_str, |
|
|
size_t | dest_str_size ) |
Returns a computer-friendly timestamp string.
- Parameters
-
dest_str | - Pointer to buffer that stores the log string |
dest_str_size | - Maximum length of dest_str buffer |
The string identifies the timestamp of the last time synchronization, the synchronization source (N - none; G - GNSS/GPS; T - telecommand), and the time passed in ms since the last synchronization. Added together, the two numbers represent the current unix timestamp in ms. Example: "1719169299720+0000042000_N"
◆ TIME_get_current_unix_epoch_time_ms()
uint64_t TIME_get_current_unix_epoch_time_ms |
( |
| ) |
|
Returns the current unix timestamp, in milliseconds.
◆ TIME_get_current_utc_datetime_str()
void TIME_get_current_utc_datetime_str |
( |
char * | dest_str, |
|
|
size_t | dest_str_size ) |
◆ TIME_set_current_unix_epoch_time_ms()
Use this function in a telecommand, or upon receiving a time update from the GNSS.
◆ TIME_sync_source_enum_to_letter_char()
◆ TIME_last_synchronization_source
◆ TIME_system_uptime_at_last_time_resync_ms
uint32_t TIME_system_uptime_at_last_time_resync_ms |
|
extern |
◆ TIME_unix_epoch_time_at_last_time_resync_ms
uint64_t TIME_unix_epoch_time_at_last_time_resync_ms |
|
extern |