标签:
#include <android/log.h> #define LOG_TAG "" #define LOGD(...) __android_log_print(ANDROID_LOG_DEBUG, LOG_TAG, __VA_ARGS__) struct timeval xTime; int xRet = gettimeofday(&xTime, NULL); long long xFactor = 1; long long now = (long long)(( xFactor * xTime.tv_sec * 1000) + (xTime.tv_usec / 1000)); LOGD("sec_d = %d, sec_ld = %ld, sec_lld = %lld\n", xTime.tv_sec, xTime.tv_sec, xTime.tv_sec); LOGD("usec_d = %d, usec_ld = %ld, usec_lld = %lld\n", xTime.tv_usec, xTime.tv_usec, xTime.tv_usec); LOGD("now_d = %d, now_ld = %ld, now_ld = %lld\n", now, now, now); LOGD("sizeof(int) = %d\n", sizeof(int)); LOGD("sizeof(long) = %d\n", sizeof(long)); LOGD("sizeof(long long) = %d\n", sizeof(long long));
输出为:
sec_d = 1327656212, sec_ld = 1327656212, sec_lld = 1327656212666 usec_d = 838745, usec_ld = 838745, usec_lld = 1327656212666 now_d = 338605759, now_ld = 511318374, now_ld = 1327656212838 (正确结果)
sizeof(int) = 4 sizeof(long) = 4 sizeof(long long) = 8
标签:
原文地址:http://www.cnblogs.com/VincentLEcho/p/4253540.html