gcc (Ubuntu/Linaro 4.6.1-9ubuntu3) 4.6.1
Apache protable runtime 1.4
c89 and compiling in -m32 mode
代码:
apr_time_t time_msecs = 0;
time_msecs = apr_time_as_msec(apr_time_now());
printf("Time in msecs [ %lu ]\n", time_msecs);
我收到以下警告:
format ‘%lu’ expects argument of type ‘long unsigned int’, but argument 2 has type ‘apr_time_t’ [-Wformat]
除了类型转换。此类型 (apr_time_t) 的正确格式说明符是什么?
非常感谢您的任何建议,
最佳答案
APR 包含一个名为 APR_TIME_T_FMT
的宏,它可能会执行您想要的操作。
构建格式字符串时,您可以像这样使用它(假设它像 stdint 宏一样工作):printf("time: %"APR_TIME_T_FMT, value);
您也可以简单地将值转换为适当的类型。
关于c - apr apr_time_h 的格式说明符,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7963580/