How to get the time in nanosecond with adb

865 views
Skip to first unread message

Mario Denote

unread,
May 1, 2013, 8:43:44 AM5/1/13
to android-...@googlegroups.com
Hi
I'm interested to retrieve time in nanoseconds

I tried

$ adb shell date +%s_%N

but it doesn't work. output is (1367416707_N)
Any suggest?

Thanks

Glenn Kasten

unread,
May 1, 2013, 12:34:54 PM5/1/13
to android-...@googlegroups.com
You can write something to get what you need, using http://linux.die.net/man/3/clock_gettime 

On Wednesday, May 1, 2013 7:49:06 AM UTC-7, coax...@gmail.com wrote:
Android is not GNU, i.e. %N is not a standard option for date. Not that you're going to get very good nanosecond accuracy from the command line anyway...

Mario Denote

unread,
May 2, 2013, 10:28:55 AM5/2/13
to android-...@googlegroups.com
But is there an option like %N?. My goal is not accuracy but only see the nanosecond value of the clock

On Wednesday, May 1, 2013 4:49:06 PM UTC+2, coax...@gmail.com wrote:
Android is not GNU, i.e. %N is not a standard option for date. Not that you're going to get very good nanosecond accuracy from the command line anyway...

On Wednesday, May 1, 2013 7:43:44 AM UTC-5, Mario Denote wrote:

Kristopher Micinski

unread,
May 2, 2013, 10:35:42 AM5/2/13
to android-...@googlegroups.com
Wait... How is that statement at all consistent?

If you want nanosecond accuracy, why should accuracy not be a huge
factor? Accuracy isn't the same as precision, but there are so many
factors in play (e.g., garbage collection) that you really should give
some details as to what you want to do with this information: maybe
there is a better way to more accurately collect timing information
for whatever you want to do.

Kris
> --
> You received this message because you are subscribed to the Google Groups
> "android-platform" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to android-platfo...@googlegroups.com.
> To post to this group, send email to android-...@googlegroups.com.
> Visit this group at http://groups.google.com/group/android-platform?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>

Mario Denote

unread,
May 2, 2013, 10:44:55 AM5/2/13
to android-...@googlegroups.com
I have to compare two clocks of different devices. I want estimate the drift beetwen two clock.
Now i can retrieve the time in seconds (no drift)
Accuracy is not a goal but i want to see the drift with a more precision than seconds.
Reply all
Reply to author
Forward
0 new messages