1

The date command in epoch time mode only gives seconds resolution when called from inside adb shell on android device (e.g. date +%s.%N returns 14403022.N... so I can only use date +%s)

I need a small terminal program that I can run from adb shell to record a timestamp. I know I can use java methods such as System.currentTimeMillis() and System.nanoTime() from inside my android application to record time.... however, how can I compile a little program that I can just call from adb shell simply to record time values with either System.currentTimeMillis() and System.nanoTime()?

22332112
  • 2,337
  • 5
  • 21
  • 42
  • 1
    These related might be useful: 1) [Adding a custom tool to the android adb shell](http://stackoverflow.com/questions/23131081/adding-a-custom-tool-to-the-android-adb-shell) and 2) [How can i run C binary (executable file) in Android from Android Shell](http://stackoverflow.com/questions/9868309/how-can-i-run-c-binary-executable-file-in-android-from-android-shell) – Richard Le Mesurier May 30 '14 at 17:09

1 Answers1

1

To get current time with high resolution in your android shell scripts use $EPOCHREALTIME built-in shell variable.

Alex P.
  • 30,437
  • 17
  • 118
  • 169