diff --git a/esphome/core/time.h b/esphome/core/time.h index 0d47ce820b..13a0127156 100644 --- a/esphome/core/time.h +++ b/esphome/core/time.h @@ -44,32 +44,14 @@ struct ESPTime { size_t strftime(char *buffer, size_t buffer_len, const char *format); /** Convert this ESPTime struct to a string as specified by the format argument. - * @see https://www.gnu.org/software/libc/manual/html_node/Formatting-Calendar-Time.html#index-strftime + * @see https://en.cppreference.com/w/c/chrono/strftime * - * @warning This method uses dynamically allocated strings which can cause heap fragmentation with some - * microcontrollers. - * - * @warning This method can return "ERROR" when the underlying strftime() call fails, e.g. when the - * format string contains unsupported specifiers or when the format string doesn't produce any - * output. + * @warning This method can return "ERROR" when the underlying strftime() call fails or when the + * output exceeds 128 bytes. */ std::string strftime(const std::string &format); - /** Convert this ESPTime struct to a string as specified by the format argument. - * @see https://www.gnu.org/software/libc/manual/html_node/Formatting-Calendar-Time.html#index-strftime - * - * This overload is optimized for string literals and avoids std::string parameter overhead. - * - * @param format The format string (null-terminated C string) - * @param format_len Optional length of the format string. If 0 (default), strlen() will be called. - * - * @warning This method uses dynamically allocated strings which can cause heap fragmentation with some - * microcontrollers. - * - * @warning This method can return "ERROR" when the underlying strftime() call fails, e.g. when the - * format string contains unsupported specifiers or when the format string doesn't produce any - * output. - */ + /// @copydoc strftime(const std::string &format) std::string strftime(const char *format, size_t format_len = 0); /// Check if this ESPTime is valid (all fields in range and year is greater than 2018)