summaryrefslogtreecommitdiff
path: root/pfinet/mapped-time.h
blob: bcbfc6d49353c17febbc572f583dcfa8f026ca1a (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
28
29
30
#ifndef _MAPPED_TIME_H_
#define _MAPPED_TIME_H_

#include <maptime.h>

#define HZ 100

extern volatile struct mapped_time_value *mapped_time;
extern long long root_jiffies;

extern inline int
read_mapped_secs ()
{
  return mapped_time->seconds;
}

extern inline int
fetch_jiffies ()
{
  struct timeval tv;
  long long j;

  maptime_read (mapped_time, &tv);

  j = (long long) tv.tv_sec * HZ + ((long long) tv.tv_usec * HZ) / 1000000;
  return j - root_jiffies;
}


#endif