#ifndef _TIME_H
#define _TIME_H

#ifndef _TIME_T
#define _TIME_T
typedef long time_t;		// GMT 1970 1 1 տʼʱ䣨ʱ䣩
#endif

#ifndef _SIZE_T
#define _SIZE_T
typedef unsigned int size_t;
#endif

#define CLOCKS_PER_SEC 100	// ϵͳʱӵδƵʣ100HZ

typedef long clock_t;		// ӽ̿ʼϵͳʱӵδ

struct tm
{
  int tm_sec;			//  [059]
  int tm_min;			//  [ 059]
  int tm_hour;			// Сʱ [059]
  int tm_mday;			// 1 µ [031]
  int tm_mon;			// 1 · [011]
  int tm_year;			// 1900 꿪ʼ
  int tm_wday;			// 1 еĳ [06] =0
  int tm_yday;			// 1 еĳ [0365]
  int tm_isdst;			// ʱ־
};

// йʱĺԭ͡
// ȷʹʱ䡣سôʱ䣨δĽֵ
clock_t clock (void);
// ȡʱ䣨ش1970.1.1:0:0:0 ʼΪʱ䣩
time_t time (time_t * tp);
// ʱʱtime2 time1 ֮侭
double difftime (time_t time2, time_t time1);
// tm ṹʾʱתʱ䡣
time_t mktime (struct tm *tp);

// tm ṹʾʱתһַָôָ롣
char *asctime (const struct tm *tp);
// ʱתһַʽ硰Wed Jun 30 21:49:08:1993\n
char *ctime (const time_t * tp);
// ʱתtm ṹʾUTC ʱ䣨UTC - ʱUniversal Time Code
struct tm *gmtime (const time_t * tp);
// ʱתtm ṹʾָʱ(timezone)ʱ䡣
struct tm *localtime (const time_t * tp);
// tm ṹʾʱøʽַfmt ת󳤶Ϊsmax ַ洢s С
size_t strftime (char *s, size_t smax, const char *fmt, const struct tm *tp);
// ʼʱתϢʹûTZzname гʼ
// ʱصʱתнԶøú
void tzset (void);

#endif
