CTS-SAT-1-OBC-Firmware
|
#include "timekeeping/timekeeping.h"
#include "debug_tools/debug_uart.h"
#include "transforms/arrays.h"
#include "log/log.h"
#include "stm32l4xx_hal.h"
#include <stdio.h>
#include <inttypes.h>
#include <string.h>
#include <time.h>
Functions | |
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_convert_uptime_to_unix_epoch_time_ms (uint32_t uptime_ms) |
Convert the system uptime to a unix epoch time in ms. | |
uint64_t | TIME_get_current_unix_epoch_time_ms () |
Returns the current unix timestamp, in milliseconds. | |
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) |
Variables | |
uint64_t | TIME_unix_epoch_time_at_last_time_resync_ms = 0 |
static char | TIME_unix_epoch_time_at_last_time_resync_ms_str [14] = "0000000000000" |
uint32_t | TIME_system_uptime_at_last_time_resync_ms = 0 |
TIME_sync_source_enum_t | TIME_last_synchronization_source = TIME_SYNC_SOURCE_NONE |
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.
uptime_ms | System uptime in ms, as returned by HAL_GetTick(). |
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_format_utc_datetime_str | ( | char * | dest_str, |
size_t | dest_str_size, | ||
uint64_t | timestamp_ms, | ||
TIME_sync_source_enum_t | sync_source ) |
uint32_t TIME_get_current_system_uptime_ms | ( | void | ) |
void TIME_get_current_timestamp_str | ( | char * | dest_str, |
size_t | dest_str_size ) |
Returns a computer-friendly timestamp string.
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"
uint64_t TIME_get_current_unix_epoch_time_ms | ( | ) |
Returns the current unix timestamp, in milliseconds.
void TIME_get_current_utc_datetime_str | ( | char * | dest_str, |
size_t | dest_str_size ) |
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.
char TIME_sync_source_enum_to_letter_char | ( | TIME_sync_source_enum_t | source | ) |
TIME_sync_source_enum_t TIME_last_synchronization_source = TIME_SYNC_SOURCE_NONE |
uint32_t TIME_system_uptime_at_last_time_resync_ms = 0 |
uint64_t TIME_unix_epoch_time_at_last_time_resync_ms = 0 |
|
static |