[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
@@ -106,9 +106,9 @@ DateCall &DateCall::set_date(uint16_t year, uint8_t month, uint8_t day) {
|
||||
|
||||
DateCall &DateCall::set_date(ESPTime time) { return this->set_date(time.year, time.month, time.day_of_month); };
|
||||
|
||||
DateCall &DateCall::set_date(const std::string &date) {
|
||||
DateCall &DateCall::set_date(const char *date, size_t len) {
|
||||
ESPTime val{};
|
||||
if (!ESPTime::strptime(date, val)) {
|
||||
if (!ESPTime::strptime(date, len, val)) {
|
||||
ESP_LOGE(TAG, "Could not convert the date string to an ESPTime object");
|
||||
return *this;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user