I need to get timestamps in nanoseconds in Android shell. Using date command (from busybox and Cyanogenmod) returns to me this:
@A001 # date +%s.%N
1819.N
The only other working option that I found is using www.timeapi.org.
curl -sSw'\n' http://www.timeapi.org/utc/now?\\s.\\N >> ctime_tar.txt
However, it requires connection and also takes 0.1 seconds to execute.
What can I use? I really need to get time in nanoseconds, especially something I can execute as a single command.
You could try to use EPOCHREALTIME environment variable:
$ adb shell echo \$EPOCHREALTIME
1430637292.923135
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With