|
发表于 2003-10-1 14:48:17
|
显示全部楼层
- include <stdio.h>
- #include <time.h>
- int main()
- {
- char localTime[100];
- const time_t *timep;
-
- sprintf(localTime, ctime(timep));
- printf("%s", localTime);
-
- return 0;
- }
复制代码
这个是获取本地时间。参考一下。
- #include <stdio.h>
- #include <time.h>
- int main()
- {
- char localTime[100];
- const time_t *timep;
- ctime_r(timep, localTime);
- printf("%s", localTime);
- return 0;
- }
复制代码
更简单。
|
|