Ejemplo n.º 1
0
static void DisplayDate(void)
{
  if ( QueryFirstContact() )
  {
    int First;
    int Second;

    /* determine if month or day is displayed first */
    if ( GetDateFormat() == MONTH_FIRST )
    {
      First = GetRTCMON();
      Second = GetRTCDAY();
    }
    else
    {
      First = GetRTCDAY();
      Second = GetRTCMON();
    }
    if ( GetTimeFormat() == TWELVE_HOUR )
    {
    	DisplayDayMonth(First, Second, 20);
    }
    else
    {
    	int year = GetRTCYEAR();
    	DisplayDayMonth(First, Second, 10);

    	/* Write the year */
    	DisplayYear(year, 20, 8);
    }
  }
}
Ejemplo n.º 2
0
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();

}
Ejemplo n.º 3
0
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));
}
Ejemplo n.º 4
0
static void SetDate(NumberEntry *dateEditor)
{
	dateEditor->SetRangeValueAt(0, 2, GetRTCDAY());
	dateEditor->SetRangeValueAt(3, 2, GetRTCMON());
	dateEditor->SetRangeValueAt(6, 4, GetRTCYEAR());
}