diff --git a/bazaar/Functions4U/Functions4U.cpp b/bazaar/Functions4U/Functions4U.cpp index a5eaf9afd..38cbc2d52 100644 --- a/bazaar/Functions4U/Functions4U.cpp +++ b/bazaar/Functions4U/Functions4U.cpp @@ -2535,4 +2535,22 @@ Image GetRect(const Image& orig, const Rect &r) { return ib; } + +double tmGetTimeX() { +#ifdef __linux__ + struct timeval t; + if(gettimeofday(&t, 0) != 0) + return Null; + return t.tv_sec + t.tv_usec/1E6; +#elif defined(_WIN32) || defined(WIN32) + LARGE_INTEGER clock; + LARGE_INTEGER freq; + if(!QueryPerformanceCounter(&clock) || !QueryPerformanceFrequency(&freq)) + return Null; + return double(clock.QuadPart)/freq.QuadPart; +#else + return double(time(0)); // Low resolution +#endif +} + END_UPP_NAMESPACE \ No newline at end of file diff --git a/bazaar/Functions4U/Functions4U.h b/bazaar/Functions4U/Functions4U.h index b839c7aae..cbbb1b985 100644 --- a/bazaar/Functions4U/Functions4U.h +++ b/bazaar/Functions4U/Functions4U.h @@ -73,7 +73,7 @@ bool IsReadOnly(const char *path, bool &usr, bool &grp, bool &oth); String LoadFile_Safe(const String fileName); String LoadFile(const char *fileName, off_t from, size_t len = 0); -int64 GetLength(const char *fileDirName); +int64 GetLength(const char *fileDirName); int64 GetDirectoryLength(const char *directoryName); /////////////////////////////// @@ -527,6 +527,8 @@ Color RandomColor(); Image GetRect(const Image& orig, const Rect &r); +double tmGetTimeX(); + class _NRFuse { public: _NRFuse(bool *_inside) {inside = _inside; failed = true;}