mirror of
https://github.com/tbnobody/OpenDTU.git
synced 2026-01-03 19:33:47 +01:00
Move the conversation from time_t to String into DevInfoParser
This commit is contained in:
@@ -137,6 +137,14 @@ time_t DevInfoParser::getFwBuildDateTime() const
|
||||
return timegm(&timeinfo);
|
||||
}
|
||||
|
||||
String DevInfoParser::getFwBuildDateTimeStr() const
|
||||
{
|
||||
char timebuffer[32];
|
||||
const time_t t = getFwBuildDateTime();
|
||||
std::strftime(timebuffer, sizeof(timebuffer), "%Y-%m-%d %H:%M:%S", gmtime(&t));
|
||||
return timebuffer;
|
||||
}
|
||||
|
||||
uint16_t DevInfoParser::getFwBootloaderVersion() const
|
||||
{
|
||||
HOY_SEMAPHORE_TAKE();
|
||||
@@ -254,4 +262,4 @@ time_t DevInfoParser::timegm(const struct tm* t)
|
||||
result -= 3600;
|
||||
/*@ -matchanyintegral @*/
|
||||
return (result);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,6 +21,7 @@ public:
|
||||
|
||||
uint16_t getFwBuildVersion() const;
|
||||
time_t getFwBuildDateTime() const;
|
||||
String getFwBuildDateTimeStr() const;
|
||||
uint16_t getFwBootloaderVersion() const;
|
||||
|
||||
uint32_t getHwPartNumber() const;
|
||||
@@ -43,4 +44,4 @@ private:
|
||||
|
||||
uint8_t _payloadDevInfoSimple[DEV_INFO_SIZE] = {};
|
||||
uint8_t _devInfoSimpleLength = 0;
|
||||
};
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user