summaryrefslogtreecommitdiffstats
path: root/tapset/timestamp.stp
diff options
context:
space:
mode:
authorfche <fche>2005-09-07 02:16:59 +0000
committerfche <fche>2005-09-07 02:16:59 +0000
commitff17e83089dee8d23e51cf55f8ea3a28c07dedee (patch)
treeafd37ba5838c793f80f83f550dd91148474c435a /tapset/timestamp.stp
parent5d64f5e78eab3b1eeccca5c91aa50f8414c1e878 (diff)
downloadsystemtap-steved-ff17e83089dee8d23e51cf55f8ea3a28c07dedee.tar.gz
systemtap-steved-ff17e83089dee8d23e51cf55f8ea3a28c07dedee.tar.xz
systemtap-steved-ff17e83089dee8d23e51cf55f8ea3a28c07dedee.zip
2005-09-06 Frank Ch. Eigler <fche@elastic.org>
* 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.
Diffstat (limited to 'tapset/timestamp.stp')
-rw-r--r--tapset/timestamp.stp10
1 files changed, 9 insertions, 1 deletions
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 <linux/time.h>
%}
+
+// 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