summaryrefslogtreecommitdiffstats
path: root/tapset/timestamp.stp
blob: f8e1ea4ef9693013df5fd064ee58a75fc030b3a4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
%{
#include <linux/time.h>
%}

// return in milliseconds since epoch
function gettimeofday_ms () %{
  struct timeval tm;
  do_gettimeofday (& tm);
  THIS->__retvalue = (tm.tv_sec * 1000) + (tm.tv_usec / 1000);
%}

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

// likewise jiffies, monotonic_clock ...