X-Git-Url: https://codewiz.org/gitweb?a=blobdiff_plain;f=os%2Fhptime.c;h=23807580feaab41771dbd3cc647e91ee98668876;hb=HEAD;hp=57ccf34df46462c52fa6657a199558f5e47b30d7;hpb=5f89cb2ec6cff67bd539eaed89f237ea42a1548e;p=bertos.git diff --git a/os/hptime.c b/os/hptime.c deleted file mode 100755 index 57ccf34d..00000000 --- a/os/hptime.c +++ /dev/null @@ -1,75 +0,0 @@ -/*! - * \file - * - * - * \brief Portable abstraction for high-resolution time handling (implementation) - * - * \version $Id$ - * \author Bernardo Innocenti - */ - -/*#* - *#* $Log$ - *#* Revision 1.6 2006/02/20 01:46:46 bernie - *#* Port to MacOSX. - *#* - *#* Revision 1.5 2005/11/04 16:20:02 bernie - *#* Fix reference to README.devlib in header. - *#* - *#* Revision 1.4 2004/08/25 14:12:09 rasky - *#* Aggiornato il comment block dei log RCS - *#* - *#* Revision 1.3 2004/08/10 05:45:04 bernie - *#* Fix spacing in header. - *#* - *#* Revision 1.2 2004/06/03 11:27:09 bernie - *#* Add dual-license information. - *#* - *#* Revision 1.1 2004/06/03 09:01:06 bernie - *#* Import into DevLib. - *#* - *#*/ - -#include "hptime.h" - -#if defined(_WIN32) - -#include - -hptime_t hptime_get(void) -{ - FILETIME ft; - - /* - * La precisione dei FileTime sarebbe 100ns, ma il - * valore viene ottenuto convertendo una struttura - * SYSTEMTIME, che ha precisione di 1ms. Il numero - * che otteniamo e' quindi sempre un multiplo di - * 100000. - */ - GetSystemTimeAsFileTime(&ft); - - /* Copy the upper/lower into a quadword. */ - return (((hptime_t)ft.dwHighDateTime) << 32) + (hptime_t)ft.dwLowDateTime; -} - -#elif defined(__unix__) || defined(__APPLE__) && defined(__MACH__) - -#include - -hptime_t hptime_get(void) -{ - struct timeval tv; - - gettimeofday(&tv, 0); - return (hptime_t)tv.tv_sec * HPTIME_TICKS_PER_SECOND - + (hptime_t)tv.tv_usec; -} - -#else /* !__unix__ */ - #error OS dependent support code missing for this OS -#endif /* !__unix__ */ -