C语言获取时间的方法
#include<time.h>
int main()
{
time_t timep;
struct tm *p;
time (&timep);
p=gmtime(&timep);
printf("%d\n",p->tm_sec); /获取当前bai秒du/
printf("%d\n",p->tm_min); /获取当前分/
printf("%d\n",8+p->tm_hour);/获取当前时,这里获取西方的时zhi间,刚好相差八个小时/
printf("%d\
转载
2020-09-20 16:04:26 ·
854 阅读 ·
0 评论