void halRtcGet(RTC_DATA* pRtcData) { tWordByteUnion temp; temp.word = GetRTCYEAR(); pRtcData->Year = temp.byte.b0 | (temp.byte.b1 << 8); pRtcData->Month = GetRTCMON(); pRtcData->DayOfMonth = GetRTCDAY(); pRtcData->DayOfWeek = GetRTCDOW(); pRtcData->Hour = GetRTCHOUR(); pRtcData->Minute = GetRTCMIN(); pRtcData->Second = GetRTCSEC(); }
static void DisplayDayOfWeek(void) { int DayOfWeek = GetRTCDOW(); unsigned char const *pFoo = DaysOfWeek[DayOfWeek]; if ( GetTimeFormat() == TWELVE_HOUR ) { WriteFoo(pFoo,10,8); } else { // move it up so we can fit the year WriteFoo(pFoo,0,8); } }
void TimeFace::OnPaintAll(Bitmap *destination) { int w = destination->Width(); int h = destination->Height(); int cx = w / 2; int cy = h / 2; destination->FillRect(0, 0, w, h, false); { char buf[10]; int y = cy + 10; MetaWatch_Combined_8pt.Print(destination, 20, y, daysOfWeek[GetRTCDOW()]); goodsprintf(buf, "%i/%2i", GetRTCDAY(), GetRTCMON() ); y += MetaWatch_Combined_8pt.Height(); MetaWatch_Small_8pt.Print(destination, 20, y, buf); goodsprintf(buf, "%4i", GetRTCYEAR() ); y += MetaWatch_Small_8pt.Height(); MetaWatch_Small_8pt.Print(destination, 20, y, buf); } // Clock markings for (int i = 0; i < 12; i++) DrawHand(destination, cx, cy, htTick, GetRadians(i, 12)); int hour = GetRTCHOUR() % 12; int minute = GetRTCMIN(); int second = GetRTCSEC(); // Hour int hourFull = (hour * 60) + minute; DrawHand(destination, cx, cy, htHour, GetRadians(hourFull, 12 * 60)); // Minute int minuteFull = (minute * 60) + second; DrawHand(destination, cx, cy, htMinute, GetRadians(minuteFull, 60 * 60)); // Second DrawHand(destination, cx, cy, htSecond, GetRadians(second, 60)); }