string conversion utility in rtc driver

This commit is contained in:
Emanuele Trabattoni
2025-07-27 13:59:50 +02:00
parent 448e1bad15
commit ad90702ab6
6 changed files with 128 additions and 54 deletions

View File

@@ -185,6 +185,12 @@ namespace drivers
return buf.substr(0, std::min(buf.find('\n'),buf.find('\r')));
}
const std::string PCF85063::tm2str(const std::tm &datetime)
{
const std::string buf(std::asctime(&datetime));
return buf.substr(0, std::min(buf.find('\n'),buf.find('\r')));
}
const std::tm PCF85063::datetime2tm(const datetime_t& datetime) {
tm dtime;
dtime.tm_sec = datetime.second;