mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-16 06:23:18 +00:00
version 3.1.4
This commit is contained in:
42
bin/src/php_phrasea2/phrasea_engine/phrasea_clock_t.cpp
Executable file
42
bin/src/php_phrasea2/phrasea_engine/phrasea_clock_t.cpp
Executable file
@@ -0,0 +1,42 @@
|
||||
#include "base_header.h"
|
||||
#include "phrasea_clock_t.h"
|
||||
|
||||
#ifndef COMPILE_DL_PHRASEA2
|
||||
#error COMPILE_DL_PHRASEA2 is false
|
||||
|
||||
#endif
|
||||
|
||||
# ifdef PHP_WIN32
|
||||
|
||||
void startChrono(CHRONO &chrono)
|
||||
{
|
||||
chrono = GetTickCount();
|
||||
}
|
||||
double stopChrono(CHRONO &chrono)
|
||||
{
|
||||
return((double)(GetTickCount()-chrono) / 1000.0);
|
||||
}
|
||||
|
||||
|
||||
# else
|
||||
|
||||
void startChrono(CHRONO &chrono)
|
||||
{
|
||||
gettimeofday(&chrono, NULL);
|
||||
return;
|
||||
}
|
||||
double stopChrono(CHRONO &chrono)
|
||||
{
|
||||
struct timeval t;
|
||||
gettimeofday(&t, NULL);
|
||||
t.tv_sec -= chrono.tv_sec;
|
||||
t.tv_usec -= chrono.tv_usec;
|
||||
if(t.tv_usec < 0)
|
||||
{
|
||||
t.tv_sec--;
|
||||
t.tv_usec += 1000000;
|
||||
}
|
||||
return((double)(t.tv_sec) + ((double)(t.tv_usec))/1000000);
|
||||
}
|
||||
|
||||
#endif
|
Reference in New Issue
Block a user