From 1bd404fb9c72f2737d25a275c9239aa110be58fe Mon Sep 17 00:00:00 2001 From: Thorsten Liebig Date: Sun, 6 Jun 2010 00:47:56 +0200 Subject: [PATCH] more accurate time measurement for operator creation Signed-off-by: Thorsten Liebig --- openems.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/openems.cpp b/openems.cpp index dfb71a4..7e3439a 100644 --- a/openems.cpp +++ b/openems.cpp @@ -147,7 +147,9 @@ int openEMS::SetupFDTD(const char* file) Reset(); int bounds[6]; - time_t startTime=time(NULL); + timeval startTime; + gettimeofday(&startTime,NULL); + TiXmlDocument doc(file); if (!doc.LoadFile()) @@ -277,11 +279,12 @@ int openEMS::SetupFDTD(const char* file) if (m_debugPEC) FDTD_Op->DumpPEC2File("PEC_dump.vtk"); - time_t OpDoneTime=time(NULL); + timeval OpDoneTime; + gettimeofday(&OpDoneTime,NULL); FDTD_Op->ShowStat(); - cout << "Creation time for operator: " << difftime(OpDoneTime,startTime) << " s" << endl; + cout << "Creation time for operator: " << CalcDiffTime(OpDoneTime,startTime) << " s" << endl; //create FDTD engine FDTD_Eng = FDTD_Op->CreateEngine();