4 * Copyright 2003, 2004 Develer S.r.l. (http://www.develer.com/)
5 * This file is part of DevLib - See README.devlib for information.
8 * \brief Portable abstraction for high-resolution time handling (interface)
11 * \author Bernardo Innocenti <bernie@develer.com>
18 #endif /* __cplusplus */
22 /** our type for "high precision absolute time" */
23 typedef __int64 hptime_t;
25 #define HPTIME_TICKS_PER_SECOND (10000000I64)
26 #define HPTIME_TICKS_PER_MILLISEC (10000I64)
27 #define HPTIME_TICKS_PER_MICRO (10I64)
29 #elif defined(__unix__) || (defined(__APPLE__) && defined(__MACH__))
31 #include <stdint.h> /* int64_t */
33 #ifndef DEVLIB_MTIME_DEFINED
34 #define DEVLIB_MTIME_DEFINED 1 /* Resolve conflict with <cfg/compiler.h> */
35 typedef int32_t mtime_t;
36 #define SIZEOF_MTIME_T (32 / CPU_BITS_PER_CHAR)
37 #define MTIME_INFINITE 0x7FFFFFFFL
40 /** Type for "high precision absolute time". */
41 typedef int64_t hptime_t;
43 #define HPTIME_TICKS_PER_SECOND (1000000LL)
44 #define HPTIME_TICKS_PER_MILLISEC (1000LL)
45 #define HPTIME_TICKS_PER_MICRO (1LL)
48 #error OS dependent support code missing for this OS
49 #endif /* !__unix__ */
52 * Return the current time with the maximum precision made available from the hosting OS
54 extern hptime_t hptime_get(void);
58 #endif /* __cplusplus */