mirror of
				https://github.com/esphome/esphome.git
				synced 2025-11-03 08:31:47 +00:00 
			
		
		
		
	Merge branch 'strftime_overkill' into integration
This commit is contained in:
		@@ -46,7 +46,7 @@ struct tm ESPTime::to_c_tm() {
 | 
			
		||||
  return c_tm;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
std::string ESPTime::strftime(const char *format, size_t format_len) {
 | 
			
		||||
std::string ESPTime::strftime(const char *format) {
 | 
			
		||||
  struct tm c_tm = this->to_c_tm();
 | 
			
		||||
  char buf[128];
 | 
			
		||||
  size_t len = ::strftime(buf, sizeof(buf), format, &c_tm);
 | 
			
		||||
@@ -56,7 +56,7 @@ std::string ESPTime::strftime(const char *format, size_t format_len) {
 | 
			
		||||
  return "ERROR";
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
std::string ESPTime::strftime(const std::string &format) { return this->strftime(format.c_str(), format.size()); }
 | 
			
		||||
std::string ESPTime::strftime(const std::string &format) { return this->strftime(format.c_str()); }
 | 
			
		||||
 | 
			
		||||
bool ESPTime::strptime(const std::string &time_to_parse, ESPTime &esp_time) {
 | 
			
		||||
  uint16_t year;
 | 
			
		||||
 
 | 
			
		||||
@@ -55,7 +55,7 @@ struct ESPTime {
 | 
			
		||||
  std::string strftime(const std::string &format);
 | 
			
		||||
 | 
			
		||||
  /// @copydoc strftime(const std::string &format)
 | 
			
		||||
  std::string strftime(const char *format, size_t format_len = 0);
 | 
			
		||||
  std::string strftime(const char *format);
 | 
			
		||||
 | 
			
		||||
  /// Check if this ESPTime is valid (all fields in range and year is greater than 2018)
 | 
			
		||||
  bool is_valid() const { return this->year >= 2019 && this->fields_in_range(); }
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user