Functions4U: Added tmGetTimeX

git-svn-id: svn://ultimatepp.org/upp/trunk@8395 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
koldo 2015-04-30 09:13:06 +00:00
parent 7b0efc479f
commit 59e67bb00c
2 changed files with 21 additions and 1 deletions

View file

@ -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

View file

@ -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;}