变量定义如下:
nsecs_t currentTime
使用如下代码,
ALOGI("Vigi *** currentTime = %ld", currentTime);
会打印报错:
error: format specifies type 'long long' but the argument has type 'nsecs_t' (aka 'long') [-Werror,-Wformat]
==========================================================================================
但是使用如下format方式
ALOGI("Vigi *** currentTime = %ld", currentTime);
会反过来打印报错:
error: format specifies type 'long' but the argument has type 'nsecs_t' (aka 'long long') [-Werror,-Wformat]
所以这里暂时强制转换为long,才可以编译通过。
ALOGI("Vigi *** currentTime = %ld", (long)currentTime);
输出的打印语句为:
01-13 14:34:39.847: I/*****: Vigi ***** currentTime = 275012420169
参考: