aboutsummaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
authorEugene Sandulenko2007-12-28 07:43:52 +0000
committerEugene Sandulenko2007-12-28 07:43:52 +0000
commitef319ad6745678275a4c5eb159d6d95fdf17649f (patch)
tree216cba22fab48bcce82cdf12edcd95a74f6afb21 /common
parentd4d072fe0484918b6caf4571b933a9b374177e5b (diff)
downloadscummvm-rg350-ef319ad6745678275a4c5eb159d6d95fdf17649f.tar.gz
scummvm-rg350-ef319ad6745678275a4c5eb159d6d95fdf17649f.tar.bz2
scummvm-rg350-ef319ad6745678275a4c5eb159d6d95fdf17649f.zip
Patch #1859448: Add OSystem::getTimeAndDate API
svn-id: r30034
Diffstat (limited to 'common')
-rw-r--r--common/system.cpp7
-rw-r--r--common/system.h3
2 files changed, 10 insertions, 0 deletions
diff --git a/common/system.cpp b/common/system.cpp
index 9444c692d6..786b3cec1a 100644
--- a/common/system.cpp
+++ b/common/system.cpp
@@ -35,6 +35,8 @@
#include "gui/message.h"
#include "sound/mixer.h"
+#include <time.h>
+
OSystem *g_system = 0;
OSystem::OSystem() {
@@ -121,3 +123,8 @@ void OSystem::clearScreen() {
memset(screen->pixels, 0, screen->h * screen->pitch);
unlockScreen();
}
+
+void OSystem::getTimeAndDate(struct tm &t) const {
+ time_t curTime = time(0);
+ t = *localtime(&curTime);
+}
diff --git a/common/system.h b/common/system.h
index 7246389bab..98ea02df20 100644
--- a/common/system.h
+++ b/common/system.h
@@ -724,6 +724,9 @@ public:
/** Delay/sleep for the specified amount of milliseconds. */
virtual void delayMillis(uint msecs) = 0;
+
+ /** Get the current time and date. Correspond to time()+localtime(). */
+ virtual void getTimeAndDate(struct tm &t) const;
/**
* Return the timer manager singleton. For more information, refer