blob: b136f4b0c3d1fb89e2aee9d8aff822f18cd56036 (
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
|
/* -*- Mode:C; c-basic-offset:4; tab-width:4 -*-
****************************************************************************
* (C) 2003 - Rolf Neugebauer - Intel Research Cambridge
****************************************************************************
*
* File: time.h
* Author: Rolf Neugebauer (neugebar@dcs.gla.ac.uk)
* Changes:
*
* Date: Jul 2003
*
* Environment: Xen Minimal OS
* Description: Time and timer functions
*
****************************************************************************
* $Id: h-insert.h,v 1.4 2002/11/08 16:03:55 rn Exp $
****************************************************************************
*/
#ifndef _TIME_H_
#define _TIME_H_
#include <list.h>
/*
* System Time
* 64 bit value containing the nanoseconds elapsed since boot time.
* This value is adjusted by frequency drift.
* NOW() returns the current time.
* The other macros are for convenience to approximate short intervals
* of real time into system time
*/
typedef s64 s_time_t;
#define NOW() ((s_time_t)get_s_time())
#define SECONDS(_s) (((s_time_t)(_s)) * 1000000000UL )
#define TENTHS(_ts) (((s_time_t)(_ts)) * 100000000UL )
#define HUNDREDTHS(_hs) (((s_time_t)(_hs)) * 10000000UL )
#define MILLISECS(_ms) (((s_time_t)(_ms)) * 1000000UL )
#define MICROSECS(_us) (((s_time_t)(_us)) * 1000UL )
#define Time_Max ((s_time_t) 0x7fffffffffffffffLL)
#define FOREVER Time_Max
/* wall clock time */
typedef long time_t;
typedef long suseconds_t;
struct timeval {
time_t tv_sec; /* seconds */
suseconds_t tv_usec; /* microseconds */
};
/* prototypes */
void init_time(void);
s_time_t get_s_time(void);
s_time_t get_v_time(void);
void gettimeofday(struct timeval *tv);
#endif /* _TIME_H_ */
|