mirror of
https://github.com/portapack-mayhem/mayhem-firmware.git
synced 2025-10-19 16:22:01 +00:00
Extract timestamp formatting to string_format.
This commit is contained in:
@@ -112,3 +112,11 @@ std::string to_string_hex(const uint32_t n, const int32_t l) {
|
||||
return p;
|
||||
}
|
||||
|
||||
std::string to_string_timestamp(const rtc::RTC& value) {
|
||||
return to_string_dec_uint(value.year(), 4, '0') +
|
||||
to_string_dec_uint(value.month(), 2, '0') +
|
||||
to_string_dec_uint(value.day(), 2, '0') +
|
||||
to_string_dec_uint(value.hour(), 2, '0') +
|
||||
to_string_dec_uint(value.minute(), 2, '0') +
|
||||
to_string_dec_uint(value.second(), 2, '0');
|
||||
}
|
||||
|
Reference in New Issue
Block a user