1
I created a library for Android and it has a method that returns the milliseconds of the epoch date. I tested on 2 different architectures to validate if the returns were correct.
- armeabi-v7a: Returns a negative number other than epoch
- arm64-v8a: Returns correctly
Check if the data types could be influencing the returns and tried to return with long and had the same problem. I am using Clang (llvm) for cross-Compile and am passing the compilation parameters as per standalone toolchain and ABI android.
Compilation parameters
-target thumbv7-linux-androideabi -march=armv7-a
-mthumb -mfpu=vfpv4-d16 -mfpu=vfpv3-d16 -mfpu=neon -msoft-float
Method
#include <sys/time.h>
long getTime(){
struct timeval tp;
gettimeofday(&tp, NULL);
//Calcula os milisegundos da data epoch
long ms = tp.tv_sec * 1000 + tp.tv_usec / 1000;
return ms;
}