示例#1
0
文件: godob.cpp 项目: mmoller2k/godob
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);
  } 
}
示例#3
0
文件: DateFormats.cpp 项目: kiuz/Time
/**
 * 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());
}
示例#4
0
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);
}
示例#5
0
//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();
}
示例#6
0
char* weekdayStr(time_t t) {
  refreshCache(t);
  return dayShortStr(tm.Wday);
}