time - 无法使用struct tms编译代码

标签 time compiler-errors tms

#if defined(HAVE_TIMES)
#include <unistd.h>
static double cycles_diff(struct tms *a,struct tms *b)
{

      clock_t aa = a->tms_utime  +
                   a->tms_stime  +
                   a->tms_cutime +
                   a->tms_cstime;

      clock_t bb = b->tmstms_utime
            +      b->tms_stime
            +      b->tms_cutime
            +      b->tms_cstime;

      return (aa-bb)/(double)sysconf(_SC_CLK_TCK);
  }
}

这会带来错误

incomplete type declaration of struc tms





sysconf was not declared

最佳答案

According to the manual您需要#include <sys/times.h>

关于time - 无法使用struct tms编译代码,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6840695/

相关文章:

time - 当时区有夏令时更新时,我如何安排事件

oracle - 甲骨文-PLS-00382 : expression is of wrong type in subtracting dates

delphi - 选择 TadvMemo 中的列

Delphi7 TMS TDBAdvGrid 单击列标题时对数据进行排序

java - 安卓时间0 :00 pm should be displaying 12:00 pm instead

ruby - 我如何计算一段时间内的项目?

c++ - 如何获取当前日期和时间?

c++ - 在 C++ 中一起编译源文件和头文件时出错

java - Java错误: Cannot find symbol - but method is in the data type class

json - 使用 TMS WEB Core 和 JSON