[datetime] Add const char * overloads for string parsing to avoid heap allocation (#13363)
This commit is contained in:
1 parent
1f3a0490a7
commit
cd4cb8b3ec
8 files changed
+47
-28
No files matched your search
@@ -74,9 +74,9 @@ TimeCall &TimeCall::set_time(uint8_t hour, uint8_t minute, uint8_t second) {
|
||||
|
||||
TimeCall &TimeCall::set_time(ESPTime time) { return this->set_time(time.hour, time.minute, time.second); };
|
||||
|
||||
TimeCall &TimeCall::set_time(const std::string &time) {
|
||||
TimeCall &TimeCall::set_time(const char *time, size_t len) {
|
||||
ESPTime val{};
|
||||
if (!ESPTime::strptime(time, val)) {
|
||||
if (!ESPTime::strptime(time, len, val)) {
|
||||
ESP_LOGE(TAG, "Could not convert the time string to an ESPTime object");
|
||||
return *this;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user