diff options
Diffstat (limited to 'tapset/timestamp.stp')
-rw-r--r-- | tapset/timestamp.stp | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/tapset/timestamp.stp b/tapset/timestamp.stp index d0c89df8..8db0faef 100644 --- a/tapset/timestamp.stp +++ b/tapset/timestamp.stp @@ -20,21 +20,26 @@ function get_cycles:long () %{ /* pure */ %} -// return in microseconds since epoch -function gettimeofday_us:long () %{ /* pure */ +// return in nanoseconds since epoch +function gettimeofday_ns:long () %{ /* pure */ /* NOTE: we can't use do_gettimeofday because we could be called from a * context where xtime_lock is already held. See bug #2525. */ - THIS->__retvalue = _stp_gettimeofday_us(); + THIS->__retvalue = _stp_gettimeofday_ns(); %} +// return in microseconds since epoch +function gettimeofday_us:long () { + return gettimeofday_ns() / 1000; +} + // return in milliseconds since epoch function gettimeofday_ms:long () { - return gettimeofday_us() / 1000; + return gettimeofday_ns() / 1000000; } // return in seconds since epoch function gettimeofday_s:long () { - return gettimeofday_us() / 1000000; + return gettimeofday_ns() / 1000000000; } // likewise jiffies, monotonic_clock ... |