aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Sulfrian <alexander@sulfrian.net>2012-11-23 20:39:42 +0100
committerAlexander Sulfrian <alexander@sulfrian.net>2013-01-18 19:34:20 +0100
commit83794d060b9ffa30d75aacbc699163a85947439e (patch)
treeb7be14be0f79945382910d9c5ca86c9e81822b7d
parentea06d9eea810b9481eaa9b8454f77e71f0f83c02 (diff)
downloadusdx-83794d060b9ffa30d75aacbc699163a85947439e.tar.gz
usdx-83794d060b9ffa30d75aacbc699163a85947439e.tar.xz
usdx-83794d060b9ffa30d75aacbc699163a85947439e.zip
base/time: make get_time static, constructor protected
The Time class does not have any state so the get_time method could be static. Because the Time class now has only static methods, deny creation by making the ctor protected.
-rw-r--r--src/base/time.cpp1
-rw-r--r--src/base/time.hpp20
2 files changed, 18 insertions, 3 deletions
diff --git a/src/base/time.cpp b/src/base/time.cpp
index 923b47cd..f4d37e7a 100644
--- a/src/base/time.cpp
+++ b/src/base/time.cpp
@@ -29,7 +29,6 @@
namespace usdx
{
-
Time::Time(void)
{
}
diff --git a/src/base/time.hpp b/src/base/time.hpp
index 229ac3e1..9e9eac20 100644
--- a/src/base/time.hpp
+++ b/src/base/time.hpp
@@ -27,11 +27,27 @@
namespace usdx
{
+ /**
+ * Simple static-only wrapper class to get a time. This time does not need
+ * to correspond to the real clock. It should only be a changing number,
+ * that change at the same speed like the real clock. The current
+ * implementation uses SDL and returns the milliseconds since initialization
+ * of the library.
+ */
class Time
{
- public:
+ protected:
+ /**
+ * Protected constructor. This class currently contains only static
+ methods. So there should no need to create an instance of it.
+ */
Time(void);
- float get_time();
+
+ public:
+ /**
+ * Returns the current "time" as milliseconds.
+ */
+ static float get_time();
};
};