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 (implementation)
11 * \author Bernardo Innocenti <bernie@develer.com>
16 *#* Revision 1.8 2006/07/19 12:56:28 bernie
17 *#* Convert to new Doxygen style.
19 *#* Revision 1.7 2006/07/19 12:53:58 bernie
20 *#* Documentation fixes.
22 *#* Revision 1.6 2006/02/20 01:46:46 bernie
25 *#* Revision 1.5 2005/11/04 16:20:02 bernie
26 *#* Fix reference to README.devlib in header.
28 *#* Revision 1.4 2004/08/25 14:12:09 rasky
29 *#* Aggiornato il comment block dei log RCS
31 *#* Revision 1.3 2004/08/10 05:45:04 bernie
32 *#* Fix spacing in header.
34 *#* Revision 1.2 2004/06/03 11:27:09 bernie
35 *#* Add dual-license information.
37 *#* Revision 1.1 2004/06/03 09:01:06 bernie
38 *#* Import into DevLib.
48 hptime_t hptime_get(void)
53 * La precisione dei FileTime sarebbe 100ns, ma il
54 * valore viene ottenuto convertendo una struttura
55 * SYSTEMTIME, che ha precisione di 1ms. Il numero
56 * che otteniamo e' quindi sempre un multiplo di
59 GetSystemTimeAsFileTime(&ft);
61 /* Copy the upper/lower into a quadword. */
62 return (((hptime_t)ft.dwHighDateTime) << 32) + (hptime_t)ft.dwLowDateTime;
65 #elif defined(__unix__) || (defined(__APPLE__) && defined(__MACH__))
69 hptime_t hptime_get(void)
74 return (hptime_t)tv.tv_sec * HPTIME_TICKS_PER_SECOND
75 + (hptime_t)tv.tv_usec;
79 #error OS dependent support code missing for this OS
80 #endif /* !__unix__ */