summaryrefslogtreecommitdiffstats
path: root/src/util/timeUtil.cpp
diff options
context:
space:
mode:
authorSebastian2010-05-12 19:42:27 +0200
committerSebastian2010-05-12 19:42:27 +0200
commitce3329047d378a14006ce74ec273ac59e3375303 (patch)
tree782430f270b4c7aca1b35d5b7813518e3797c555 /src/util/timeUtil.cpp
downloadpvs-ce3329047d378a14006ce74ec273ac59e3375303.tar.gz
pvs-ce3329047d378a14006ce74ec273ac59e3375303.tar.xz
pvs-ce3329047d378a14006ce74ec273ac59e3375303.zip
initial import of latest svn version
Diffstat (limited to 'src/util/timeUtil.cpp')
-rw-r--r--src/util/timeUtil.cpp42
1 files changed, 42 insertions, 0 deletions
diff --git a/src/util/timeUtil.cpp b/src/util/timeUtil.cpp
new file mode 100644
index 0000000..6f8e93d
--- /dev/null
+++ b/src/util/timeUtil.cpp
@@ -0,0 +1,42 @@
+/*
+ # Copyright (c) 2009, 2010 - OpenSLX Project, Computer Center University of
+ # Freiburg
+ #
+ # This program is free software distributed under the GPL version 2.
+ # See http://openslx.org/COPYING
+ #
+ # If you have any feedback please consult http://openslx.org/feedback and
+ # send your suggestions, praise, or complaints to feedback@openslx.org
+ #
+ # General information about OpenSLX can be found at http://openslx.org/
+ # -----------------------------------------------------------------------------
+ # timeUtil.cpp
+ # - ???.
+ # -----------------------------------------------------------------------------
+ */
+
+#include "timeUtil.h"
+
+TimeUtil::TimeUtil()
+{
+ seconds = useconds = mtime = 0;
+}
+
+void TimeUtil::start()
+{
+ gettimeofday(&Begin, NULL);
+}
+
+void TimeUtil::stop()
+{
+ gettimeofday(&End, NULL);
+ seconds = End.tv_sec - Begin.tv_sec;
+ useconds = End.tv_usec - Begin.tv_usec;
+ mtime = ((seconds) * 1000 + useconds/1000.0) + 0.5;
+}
+
+long TimeUtil::getMS()
+{
+ return mtime;
+}
+