ia64/xen-unstable

view extras/mini-os/include/time.h @ 5688:d231efdaa66d

manual merge
author iap10@freefall.cl.cam.ac.uk
date Wed Jul 06 18:55:16 2005 +0000 (2005-07-06)
parents 189c87adf876 43e8e30cbea7
children 32fb371cc283 707fcf42a5ae
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)get_s_time())
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
41 /* wall clock time */
42 typedef long time_t;
43 typedef long suseconds_t;
44 struct timeval {
45 time_t tv_sec; /* seconds */
46 suseconds_t tv_usec; /* microseconds */
47 };
50 /* prototypes */
51 void init_time(void);
52 s_time_t get_s_time(void);
53 s_time_t get_v_time(void);
54 void gettimeofday(struct timeval *tv);
55 void block(u32 millisecs);
57 #endif /* _TIME_H_ */