|
| int64_t | time_timestamp () |
| void | str_timestamp (char *buffer, int buffer_size) |
| void | str_timestamp_format (char *buffer, int buffer_size, const char *format) |
| void | str_timestamp_ex (time_t time, char *buffer, int buffer_size, const char *format) |
| bool | timestamp_from_str (const char *string, const char *format, time_t *timestamp) |
| int | str_time (int64_t centisecs, int format, char *buffer, int buffer_size) |
| int | str_time_float (float secs, int format, char *buffer, int buffer_size) |
Timestamp related functions.
Time
◆ str_time()
| int str_time |
( |
int64_t | centisecs, |
|
|
int | format, |
|
|
char * | buffer, |
|
|
int | buffer_size ) |
Formats a time string.
- Parameters
-
| centisecs | Time in centiseconds. |
| format | Format of the time string, see enum above, for example TIME_DAYS. |
| buffer | Pointer to a buffer that shall receive the timestamp string. |
| buffer_size | Size of the buffer. |
- Returns
- Number of bytes written, -1 on invalid format or buffer_size <= 0.
◆ str_time_float()
| int str_time_float |
( |
float | secs, |
|
|
int | format, |
|
|
char * | buffer, |
|
|
int | buffer_size ) |
Formats a time string.
- Parameters
-
| secs | Time in seconds. |
| format | Format of the time string, see enum above, for example TIME_DAYS. |
| buffer | Pointer to a buffer that shall receive the timestamp string. |
| buffer_size | Size of the buffer. |
- Returns
- Number of bytes written, -1 on invalid format or buffer_size <= 0.
◆ str_timestamp()
| void str_timestamp |
( |
char * | buffer, |
|
|
int | buffer_size ) |
Copies a timestamp of the current time in the format year-month-day_hour-minute-second to the string.
- Parameters
-
| buffer | Pointer to a buffer that shall receive the timestamp string. |
| buffer_size | Size of the buffer. |
◆ str_timestamp_ex()
| void str_timestamp_ex |
( |
time_t | time, |
|
|
char * | buffer, |
|
|
int | buffer_size, |
|
|
const char * | format ) |
Copies a timestamp of the given time in the given format to the string.
- Parameters
-
| time | The time value to represent as a string. |
| buffer | Pointer to a buffer that shall receive the timestamp string. |
| buffer_size | Size of the buffer. |
| format | Time formatting string. See https://cppreference.com/w/c/chrono/strftime.html for format description. |
◆ str_timestamp_format()
| void str_timestamp_format |
( |
char * | buffer, |
|
|
int | buffer_size, |
|
|
const char * | format ) |
Copies a timestamp of the current time in the given format to the string.
- Parameters
-
◆ time_timestamp()
| int64_t time_timestamp |
( |
| ) |
|
Retrieves the current time as a UNIX timestamp.
- Returns
- The time as a UNIX timestamp.
◆ timestamp_from_str()
| bool timestamp_from_str |
( |
const char * | string, |
|
|
const char * | format, |
|
|
time_t * | timestamp ) |
Parses a string into a timestamp following a specified format.
- Parameters
-
| string | Pointer to the string to parse. |
| format | The time format to use (for example FORMAT_NOSPACE below). |
| timestamp | Pointer to the timestamp result. |
- Returns
- true on success, false if the string could not be parsed with the specified format.