aboutsummaryrefslogtreecommitdiff
path: root/backends/PalmOS/Src/missing/_time.cpp
diff options
context:
space:
mode:
authorMax Horn2003-04-30 11:37:10 +0000
committerMax Horn2003-04-30 11:37:10 +0000
commit42f156ddada4c6f51e1612e9b0f18ec7c9dd9cee (patch)
treea2b7ba14f7f919987239902e513c1a646ca2e9f8 /backends/PalmOS/Src/missing/_time.cpp
parent79ebda7613b3280ae644d67af50712deef8819d7 (diff)
downloadscummvm-rg350-42f156ddada4c6f51e1612e9b0f18ec7c9dd9cee.tar.gz
scummvm-rg350-42f156ddada4c6f51e1612e9b0f18ec7c9dd9cee.tar.bz2
scummvm-rg350-42f156ddada4c6f51e1612e9b0f18ec7c9dd9cee.zip
started to merge in Chrilith's PalmOS port
svn-id: r7219
Diffstat (limited to 'backends/PalmOS/Src/missing/_time.cpp')
-rw-r--r--backends/PalmOS/Src/missing/_time.cpp38
1 files changed, 38 insertions, 0 deletions
diff --git a/backends/PalmOS/Src/missing/_time.cpp b/backends/PalmOS/Src/missing/_time.cpp
new file mode 100644
index 0000000000..afac9bce10
--- /dev/null
+++ b/backends/PalmOS/Src/missing/_time.cpp
@@ -0,0 +1,38 @@
+#include "time.h"
+
+// ignore GMT, only device time
+
+time_t time(time_t *tloc) {
+ UInt32 secs = TimGetSeconds(); // since 1/1/1904 12AM.
+ DateTimeType Epoch = {0, 0, 0, 1, 1, 1970, 0}; // form 1/1/1904 12AM to 1/1/1970 12AM
+
+ secs -= TimDateTimeToSeconds (&Epoch);
+
+ if (tloc)
+ *tloc = secs;
+
+ return (secs);
+}
+
+
+struct tm *localtime(const time_t *timer) {
+ static struct tm tmDate;
+
+ DateTimeType dt;
+ UInt32 secs = *timer;
+ DateTimeType Epoch = {0, 0, 0, 1, 1, 1970, 0}; // form 1/1/1904 12AM to 1/1/1970 12AM
+ // timer supposed to be based on Epoch
+ secs += TimDateTimeToSeconds(&Epoch);
+
+ TimSecondsToDateTime (secs, &dt);
+
+ tmDate.tm_sec = dt.second;
+ tmDate.tm_min = dt.minute;
+ tmDate.tm_hour = dt.hour;
+ tmDate.tm_mday = dt.day;
+ tmDate.tm_mon = dt.month;
+ tmDate.tm_year = dt.year;
+ tmDate.tm_wday = dt.weekDay;
+
+ return &tmDate;
+} \ No newline at end of file