X-Git-Url: https://codewiz.org/gitweb?a=blobdiff_plain;f=os%2Fhptime.c;h=23807580feaab41771dbd3cc647e91ee98668876;hb=HEAD;hp=28091fc76ac41a5ed82f294e793241b2de765ae8;hpb=77c1d6ba65a199f60faa0e0a68e63ef0eb87677c;p=bertos.git diff --git a/os/hptime.c b/os/hptime.c deleted file mode 100644 index 28091fc7..00000000 --- a/os/hptime.c +++ /dev/null @@ -1,79 +0,0 @@ -/** - * \file - * - * - * \brief Portable abstraction for high-resolution time handling (implementation) - * - * \version $Id$ - * \author Bernardo Innocenti - */ - -#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 /* for gettimeofday() */ -#include /* for NULL */ - -hptime_t hptime_get(void) -{ - struct timeval tv; - - gettimeofday(&tv, NULL); - 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__ */ -