C++问题,高手帮忙!

来源:百度知道 编辑:UC知道 时间:2024/06/05 12:16:39
调用<time.h>有什么作用啊,请讲详细一点,最好有一个例子。

// crt_times.c
/* This program demonstrates these time and date functions:
* _time64 _ftime64 _ctime64 asctime
* _localtime64 _gmtime64 _mktime64 _tzset
* _strtime _strdate strftime
*
* Also the global variable:
* _tzname
*/

#include <time.h>
#include <stdio.h>
#include <sys/types.h>
#include <sys/timeb.h>
#include <string.h>

int main()
{
char tmpbuf[128], ampm[] = "AM";
__time64_t ltime;
struct __timeb64 tstruct;
struct tm *today, *gmt, xmas = { 0, 0, 12, 25, 11, 93 };

/* Set time zone from TZ environment variable. If TZ is not set,
* the operating system is queried to obtain the default value
* for the variable.
*/
_tzset();

/* Display operating system-style date and time. */