static void simulation_rtc(void) { if(++m_date.second == 60){ m_date.second = 0; if(++m_date.minute == 60){ m_date.minute = 0; if(++m_date.hour == 24){ m_date.hour = 0; changeday(); } } } printf("time===>[%02d:%02d:%02d]\r\n",m_date.hour,m_date.minute,m_date.second); }
void cal2::newCal(QDate newdate) { sholidayhash.clear(); wholidayhash.clear(); lholidayhash.clear(); label_cal_hash.clear(); cur_date = newdate; year->setNum(cur_date.year()); month->setText(QDate::shortMonthName(cur_date.month())); int i; for(i=1;i<=42;i++) { labels[i]->resetall(); labels[i]->setEnabled(false); } QDate date(cur_date.year(),cur_date.month(),1); int firstday = date.dayOfWeek(); while(date.month()==cur_date.month()) { ChineseCalendar cncal(date); cal_label *templabe = labels[date.day()+firstday-1]; label_cal_hash.insert(templabe,cncal); templabe->setEnabled(true); templabe->day->setNum(cncal._date.day()); templabe->lunarday->setText( nStr[cncal._cDay] ); if(cncal.sterm!=0) templabe->lunarday->setText( SolarTerm[cncal.sterm] ); if(matchWeekHoliday(cncal,templabe)) { templabe->lunarday->setText(wholidayhash.value(templabe).HolidayName); templabe->bholiday->show(); } if(matchSolarHoliday(cncal,templabe)) { templabe->lunarday->setText(sholidayhash.value(templabe).HolidayName); templabe->bholiday->show(); } if(matchLunarHoliday(cncal,templabe)) { templabe->lunarday->setText(lholidayhash.value(templabe).HolidayName); templabe->bholiday->show(); } date = date.addDays(1); } cur_label = labels[cur_date.day()+firstday-1]; changeday(cur_label); }