• Alex Van Brunt's avatar
    Reimplement clock(3) using clock_gettime(3) · a5087148
    Alex Van Brunt authored
    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
    
    (cherry picked from commit 8d0b2dbf)
    
    Change-Id: Id4945d9f387330518f78669809639952e9227ed9
    a5087148
clock.cpp 1.77 KB