void CCalendar::FormatLunarYear(WORD iYear, char* pBuffer)
{
char szText1[] = "甲乙丙丁戊己庚辛壬癸";
char szText2[] = "子丑寅卯辰巳午未申酉戌亥";
char szText3[] = "鼠牛虎免龙蛇马羊猴鸡狗猪";
memcpy(pBuffer, szText1+((iYear-4)%10)*2, 2);
memcpy(pBuffer+2, szText2+((iYear-4)%12)*2, 2);
pBuffer[4]=' ';
memcpy(pBuffer+5, szText3+((iYear-4)%12)*2, 2);
strcpy(pBuffer+7, "年");
}
void CCalendar::FormatLunarHour(WORD iHour, char *pBuffer)
{
char szText[] = "子丑寅卯辰巳午未申酉戌亥";
int nIndex = (iHour + 1) / 2;
if (12 == nIndex && 23 == iHour)
{
nIndex = 0;
}
memcpy(pBuffer, szText+nIndex*2, 2);
strcpy(pBuffer+2, "时");
}