Type (Path Standard C Header / time.h)

time_t

typedef int time_t;

Store calendar time type


Using In

  time_t clock();
    Returns the time used by the processor clock, divided by CLOCKS_PER_SEC

  char* ctime(time_t *timer);
    Returns a string representing the local time based on the parameter timer

  double difftime(time_t endTime, time_t fromTime);
    return the endTime - fromTime in seconds

  struct tm* gmtime(time_t *timer);
    Populate the tm structure with the value of timer , expressed in Coordinated Universal Time (UTC) also known as Greenwich Mean Time (GMT)

  struct tm* localtime(time_t *timer);
    Fill the tm structure with the value of timer. The value of timer is decomposed into a tm structure and expressed in the local time zone

  time_t mktime(struct tm *timePtr);
    Transfer tm to time_t

  time_t time(time_t *timer);
    Get current calendar time or set calendar time

  struct tm* gmtime_r(time_t *timePtr, struct tm *result);
    Same to gmtime (Thread Safe)

类型 (属于 标准C头文件 / time.h)

time_t

typedef int time_t;

存储日历时间类型


被用于

  time_t clock();
    返回处理器时钟所使用的时间,需要除以 CLOCKS_PER_SEC

  char* ctime(time_t *timer);
    返回一个表示当地时间的字符串,当地时间是基于参数 timer

  double difftime(time_t endTime, time_t fromTime);
    计算两个时间的差值

  struct tm* gmtime(time_t *timer);
    使用 timer 的值来填充 tm 结构,并用协调世界时(UTC)也被称为格林尼治标准时间(GMT)表示

  struct tm* localtime(time_t *timer);
    使用 timer 的值来填充 tm 结构。timer 的值被分解为 tm 结构,并用本地时区表示

  time_t mktime(struct tm *timePtr);
    将tm转换为time_t

  time_t time(time_t *timer);
    得到当前日历时间或者设置日历时间

  struct tm* gmtime_r(time_t *timePtr, struct tm *result);
    等同于 gmtime (Thread Safe)