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.5 2005/11/04 16:20:02 bernie
17 *#* Fix reference to README.devlib in header.
19 *#* Revision 1.4 2004/08/25 14:12:09 rasky
20 *#* Aggiornato il comment block dei log RCS
22 *#* Revision 1.3 2004/08/10 05:45:04 bernie
23 *#* Fix spacing in header.
25 *#* Revision 1.2 2004/06/03 11:27:09 bernie
26 *#* Add dual-license information.
28 *#* Revision 1.1 2004/06/03 09:01:06 bernie
29 *#* Import into DevLib.
39 hptime_t hptime_get(void)
44 * La precisione dei FileTime sarebbe 100ns, ma il
45 * valore viene ottenuto convertendo una struttura
46 * SYSTEMTIME, che ha precisione di 1ms. Il numero
47 * che otteniamo e' quindi sempre un multiplo di
50 GetSystemTimeAsFileTime(&ft);
52 /* Copy the upper/lower into a quadword. */
53 return (((hptime_t)ft.dwHighDateTime) << 32) + (hptime_t)ft.dwLowDateTime;
56 #elif defined(__unix__)
60 hptime_t hptime_get(void)
65 return (hptime_t)tv.tv_sec * HPTIME_TICKS_PER_SECOND
66 + (hptime_t)tv.tv_usec;
70 #error OS dependent support code missing for this OS
71 #endif /* !__unix__ */