From ff17e83089dee8d23e51cf55f8ea3a28c07dedee Mon Sep 17 00:00:00 2001 From: fche Date: Wed, 7 Sep 2005 02:16:59 +0000 Subject: 2005-09-06 Frank Ch. Eigler * stap.1.in: Clarify absence of short-circuiting in && and ||. * translate.cxx (emit_function): Improve "array locals" message. * tapset/timestamp.stp: Add gettimeofday_us function. Correct arithmetic typing in other functions. * stapfuncs.5.in: Document new function. --- tapset/timestamp.stp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'tapset/timestamp.stp') diff --git a/tapset/timestamp.stp b/tapset/timestamp.stp index b71841d4..8b8aa3f2 100644 --- a/tapset/timestamp.stp +++ b/tapset/timestamp.stp @@ -2,11 +2,19 @@ #include %} + +// return in microseconds since epoch +function gettimeofday_us:long () %{ + struct timeval tm; + do_gettimeofday (& tm); + THIS->__retvalue = (tm.tv_sec * 1000000ULL) + (tm.tv_usec); +%} + // return in milliseconds since epoch function gettimeofday_ms:long () %{ struct timeval tm; do_gettimeofday (& tm); - THIS->__retvalue = (tm.tv_sec * 1000) + (tm.tv_usec / 1000); + THIS->__retvalue = (tm.tv_sec * 1000ULL) + (tm.tv_usec / 1000); %} // return in seconds since epoch -- cgit