]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - android-sdk/platform-bionic.git/commit
Reimplement clock(3) using clock_gettime(3)
authorAlex Van Brunt <avanbrunt@nvidia.com>
Fri, 26 Sep 2014 20:32:47 +0000 (13:32 -0700)
committerElliott Hughes <enh@google.com>
Sat, 4 Oct 2014 01:54:28 +0000 (18:54 -0700)
commit8d0b2dbf2154d5da17ff09b1d4f864d281362ad2
treef17c338cdad0320f0205f8d097d316c0ad2a1894
parentd5df4124bbbb30411ef19f7c2fbb3987d0eb9630
Reimplement clock(3) using clock_gettime(3)

Unlike times(), clock_gettime() is implemented as a vDSO on many architectures.
So, using clock_gettime() will return a more accurate time and do so with less
overhead because it does have the overhead of calling into the kernel.

It is also significantly more accurate because it measures the actual time in
nanoseconds rather than the number of ticks (typically 1 millisecond or more).

Bug: 17814435
Change-Id: Id4945d9f387330518f78669809639952e9227ed9
libc/bionic/clock.cpp
tests/time_test.cpp