make StopWatch more robust

This commit is contained in:
Ingo Weyrich
2019-08-09 15:45:11 +02:00
parent 55a2aae381
commit 63abfb4d66
2 changed files with 14 additions and 29 deletions

View File

@@ -16,8 +16,7 @@
* You should have received a copy of the GNU General Public License
* along with RawTherapee. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef _MYTIME_
#define _MYTIME_
#pragma once
#ifdef WIN32
#include <windows.h>
@@ -58,11 +57,11 @@ public:
t.tv_sec = tv.tv_sec;
t.tv_nsec = tv.tv_usec * 1000;
#else
clock_gettime (CLOCK_REALTIME, &t);
clock_gettime(CLOCK_REALTIME, &t);
#endif
}
int etime (MyTime a)
int etime (const MyTime &a) const
{
#ifndef WIN32
return (t.tv_sec - a.t.tv_sec) * 1000000 + (t.tv_nsec - a.t.tv_nsec) / 1000;
@@ -71,6 +70,3 @@ public:
#endif
}
};
#endif