• Keith Randall's avatar
    runtime: use libc for nanotime on Darwin · cc09212f
    Keith Randall authored
    Use mach_absolute_time and mach_timebase_info to get nanosecond-level
    timing information from libc on Darwin.
    
    The conversion code from Apple's arbitrary time unit to nanoseconds is
    really annoying.  It would be nice if we could replace the internal
    runtime "time" with arbitrary units and put the conversion to nanoseconds
    only in the places that really need it (so it isn't in every nanotime call).
    
    It's especially annoying because numer==denom==1 for all the machines
    I tried.  Makes it hard to test the conversion code :(
    
    Update #17490
    
    Change-Id: I6c5d602a802f5c24e35184e33d5e8194aa7afa86
    Reviewed-on: https://go-review.googlesource.com/110655
    Run-TryBot: Keith Randall <khr@golang.org>
    TryBot-Result: Gobot Gobot <gobot@golang.org>
    Reviewed-by: 's avatarIan Lance Taylor <iant@golang.org>
    cc09212f
defs_darwin.go 4.94 KB