在 Android 框架代码中,有一段代码以微秒为单位计算当前时间,如下所示。有谁知道为什么因子是 1000000ll 而不是 1000000?
static int64_t getNowUs() {
struct timeval tv;
gettimeofday(&tv, NULL);
return (int64_t)tv.tv_usec + tv.tv_sec * 1000000ll;
}
在 Android 框架代码中,有一段代码以微秒为单位计算当前时间,如下所示。有谁知道为什么因子是 1000000ll 而不是 1000000?
static int64_t getNowUs() {
struct timeval tv;
gettimeofday(&tv, NULL);
return (int64_t)tv.tv_usec + tv.tv_sec * 1000000ll;
}
我很确定这可能只是一个 64 位整数后缀,比如 C++。
1000000ll 是 1000000 长,整数末尾的 l 表示长,如果你看这里http://androidxref.com/source/xref/frameworks/ex/variablespeed/jni/integral_types.h它有
typedef long long int64; // NOLINT
http://androidxref.com/source/xref/frameworks/base/media/libstagefright/rtsp/ARTPAssembler.cpp