summaryrefslogtreecommitdiffstats
path: root/tapset/timestamp.stp
blob: b71841d4c56de656ed9dacdb5c391f1bc6864f96 (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:long () %{
  struct timeval tm;
  do_gettimeofday (& tm);
  THIS->__retvalue = (tm.tv_sec * 1000) + (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 ...