#include <time.h>
void systemTime()
{
time_t timep;
struct tm *p;
time(&timep);
p = gmtime(&timep);
printf("%d\n", p->tm_sec); /*獲取當前秒*/
printf("%d\n", p->tm_min); /*獲取當前分*/
printf("%d\n", 8 + p->tm_hour);/*獲取當前時,這裏獲取西方的時間,剛好相差八個小時*/
printf("%d\n", p->tm_mday);/*獲取當前月份日數,範圍是1-31*/
printf("%d\n", 1 + p->tm_mon);/*獲取當前月份,範圍是0-11,所以要加1*/
printf("%d\n", 1900 + p->tm_year);/*獲取當前年份,從1900開始,所以要加1900*/
printf("%d\n", p->tm_yday); /*從今年1月1日算起至今的天數,範圍爲0-365*/
}