admin 管理员组

文章数量: 887021


2024年1月19日发(作者:sql语句创建视图)

static int FOURYEARS = 365*3+366;static int norMoth[] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};static int leapMoth[] = {31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};void getHourMinSec(int nSecond){ int nHour = nSecond/3600; int nMin = (nSecond%3600)/60; int nSec = (nSecond%3600)%60; printf("%d:%d:%dn", nHour+8, nMin, nSec);}void getMothAndDay(bool bLeapYear, int nDays, int *nMoth, int *nDay){ int i = 0; int nTmp = 0; int *pMoth = bLeapYear?leapMoth:norMoth; for (i=0; i<12; i++) { nTmp = nDays-pMoth[i]; if (nTmp <= 0) { *nMoth = i+1; if (nTmp == 0) { *nDay = pMoth[i]; } else { *nDay = nDays; } break; } nDays = nTmp; } return;}void print_time(){ time_t nTime = time(NULL); int nDays = nTime/DAYS + ((nTime%DAYS)?1:0); int nYear4 = nDays/FOURYEARS; int nRemain = nDays%FOURYEARS; int nDecyear = 1970 + nYear4*4; int nDecmoth = 0;

int nDecday = 0; bool bLeapyear = false; if (nRemain < 365) { ; } else if (nRemain < 365*2) { nDecyear += 1; nRemain -= 365; } else if (nRemain < 365*3) { nDecyear += 2; nRemain -= 365*2; } else { nDecyear += 3; nRemain -= 365*3; bLeapyear = true; } getMothAndDay(bLeapyear, nRemain, &nDecmoth, &nDecday); printf("%d:%d:%dn", nDecyear, nDecmoth, nDecday); getHourMinSec(nTime%DAYS); return;}int main(void){print_time();return 0;

}


本文标签: 语句 创建 视图 作者