void godob::printdate(void) { char ch; // Warning! if(timeStatus() != timeSet) { LCD->setCursor(0, 1); LCD->print(F("RTC ERROR: SYNC!")); } else{ tmElements_t tm; breakTime(now(), tm); // Display abbreviated Day-of-Week in the lower left corner LCD->setCursor(0, 1); if(!Connected){ ch = '_'; } else if(reqPending){ ch = '+'; } else{ ch = '*'; } LCD->write(ch); LCD->write(' '); LCD->print(dayShortStr(tm.Wday)); LCD->print(" "); print2digits(tm.Day); LCD->print("/"); print2digits(tm.Month); LCD->print("/"); LCD->print(tm.Year+1970); } }
////////////////////////////////////////////////////////////////////////////////////////////////// // check if system date is valid and send the date header. ////////////////////////////////////////////////////////////////////////////////////////////////// void ESP8266WebServerEx::sendDateHeader(char* buf) { time_t t = now(); // if time is accurate, then try to send a Date header Wed, 15 Nov 1995 06:25:24 GMT if ( year(t)>2015 ) { char dow[5]; strncpy(dow,dayShortStr(weekday(t)),4); dow[3] = 0; sprintf(buf,"%s, %02u %s %04u %02u:%02u:%02u GMT",dow,day(t),monthShortStr(month(t)),year(t),hour(t),minute(t),second(t)); sendHeader("Date",buf); } }
/** * Display Date and Time with 'hh:mm:ss <ShortNameDayWeek> dd <ShortNameMonth> YYYY' format */ void shortStrFormat_Display(){ timeComplete_Display(); Serial.print(" "); Serial.print(dayShortStr(weekday())); Serial.print(" "); Serial.print(day()); Serial.print(" "); Serial.print(monthShortStr(month())); Serial.print(" "); Serial.print(year()); }
void Ds3231::printTime(char str[]) { char *pdate = str; pdate = printTwoDec(m_time.Hour, pdate); strcpy(pdate++, ":"); pdate = printTwoDec(m_time.Minute, pdate); strcpy(pdate++, ":"); pdate = printTwoDec(m_time.Second, pdate); strcpy(pdate++, " "); strcpy(pdate, dayShortStr(m_time.Wday)); pdate += 3; strcpy(pdate++, " "); pdate = printTwoDec(m_time.Month, pdate); strcpy(pdate++, "/"); pdate = printTwoDec(m_time.Day, pdate); }
//Function to print time with time zone void printTime(time_t t, char *tz) { sPrintI00(hour(t)); sPrintDigits(minute(t)); sPrintDigits(second(t)); Serial.print(' '); Serial.print(dayShortStr(weekday(t))); Serial.print(' '); sPrintI00(day(t)); Serial.print(' '); Serial.print(monthShortStr(month(t))); Serial.print(' '); Serial.print(year(t)); Serial.print(' '); Serial.print(tz); Serial.println(); }
char* weekdayStr(time_t t) { refreshCache(t); return dayShortStr(tm.Wday); }