summaryrefslogtreecommitdiffstats
path: root/tapset/timestamp.stp
blob: 8b8aa3f20e769ce4d5ac2c4e613d289c1eca0b51 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
%{
#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 * 1000ULL) + (tm.tv_usec / 1000);
%}

// return in seconds since epoch
function gettimeofday_s:long () %{
  struct timeval tm;
  do_gettimeofday (& tm);
  THIS->__retvalue = tm.tv_sec;
%}

// likewise jiffies, monotonic_clock ...