c - apr apr_time_h 的格式说明符

标签 c apr

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/

相关文章:

c++ - 套接字在处理后打开,打开它完成

tomcat - 基于 APR 的 Apache Tomcat Native 库……没有找到(但我有)

c - 使用具有多个客户端的管道

c - opengl glDrawElements 问题

c - 在同一台机器上运行的 C 应用程序之间的套接字通信

c - 以非选项字符开头时 getopt_long() 失败

c - 基本 Apache 模块中的链接器错误

c++ - 如何休眠 APR 线程?

c - Make 找不到函数

c - C 中的结构体定义?