ia64/xen-unstable

view extras/mini-os/include/time.h @ 10843:4f6d858ea570

[PCI] Per-device permissive flag (replaces global permissive flag).
Signed-off-by: Chris Bookholt <hap10@tycho.ncsc.mil>
author kfraser@localhost.localdomain
date Fri Jul 28 12:56:10 2006 +0100 (2006-07-28)
parents 06d84bf87159
children 0839db0aa611
line source
1 /* -*- Mode:C; c-basic-offset:4; tab-width:4 -*-
2 ****************************************************************************
3 * (C) 2003 - Rolf Neugebauer - Intel Research Cambridge
4 * (C) 2005 - Grzegorz Milos - Intel Research Cambridge
5 ****************************************************************************
6 *
7 * File: time.h
8 * Author: Rolf Neugebauer (neugebar@dcs.gla.ac.uk)
9 * Changes: Grzegorz Milos (gm281@cam.ac.uk)
10 *
11 * Date: Jul 2003, changesJun 2005
12 *
13 * Environment: Xen Minimal OS
14 * Description: Time and timer functions
15 *
16 ****************************************************************************
17 */
19 #ifndef _TIME_H_
20 #define _TIME_H_
22 /*
23 * System Time
24 * 64 bit value containing the nanoseconds elapsed since boot time.
25 * This value is adjusted by frequency drift.
26 * NOW() returns the current time.
27 * The other macros are for convenience to approximate short intervals
28 * of real time into system time
29 */
30 typedef s64 s_time_t;
31 #define NOW() ((s_time_t)monotonic_clock())
32 #define SECONDS(_s) (((s_time_t)(_s)) * 1000000000UL )
33 #define TENTHS(_ts) (((s_time_t)(_ts)) * 100000000UL )
34 #define HUNDREDTHS(_hs) (((s_time_t)(_hs)) * 10000000UL )
35 #define MILLISECS(_ms) (((s_time_t)(_ms)) * 1000000UL )
36 #define MICROSECS(_us) (((s_time_t)(_us)) * 1000UL )
37 #define Time_Max ((s_time_t) 0x7fffffffffffffffLL)
38 #define FOREVER Time_Max
39 #define NSEC_TO_USEC(_nsec) (_nsec / 1000UL)
40 #define NSEC_TO_SEC(_nsec) (_nsec / 1000000000ULL)
42 /* wall clock time */
43 typedef long time_t;
44 typedef long suseconds_t;
45 struct timeval {
46 time_t tv_sec; /* seconds */
47 suseconds_t tv_usec; /* microseconds */
48 };
50 struct timespec {
51 time_t ts_sec;
52 long ts_nsec;
53 };
56 /* prototypes */
57 void init_time(void);
58 s_time_t get_s_time(void);
59 s_time_t get_v_time(void);
60 void gettimeofday(struct timeval *tv);
61 void block_domain(u32 millisecs);
63 #endif /* _TIME_H_ */