]> git.saurik.com Git - wxWidgets.git/blob - src/msw/wince/time.cpp
More WinCE mods
[wxWidgets.git] / src / msw / wince / time.cpp
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: src/msw/wince/time.cpp
3 // Purpose: Implements missing time functionality for WinCE
4 // Author:
5 // Modified by:
6 // Created: 2003-07-10
7 // RCS-ID: $Id$
8 // Copyright:
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
11
12 // ===========================================================================
13 // declarations
14 // ===========================================================================
15
16 // ---------------------------------------------------------------------------
17 // headers
18 // ---------------------------------------------------------------------------
19
20 #ifdef __GNUG__
21 #pragma implementation "window.h"
22 #endif
23
24 // For compilers that support precompilation, includes "wx.h".
25 #include "wx/wxprec.h"
26
27 #ifdef __BORLANDC__
28 #pragma hdrstop
29 #endif
30
31 #ifndef WX_PRECOMP
32 #include <windows.h>
33 #include "wx/msw/winundef.h"
34 #endif
35
36 #include "wx/msw/wince/time.h"
37
38 long timezone = 0;
39
40 // Hint: use GetSystemTime()
41
42 struct tm * __cdecl localtime(const time_t *)
43 {
44 // TODO
45 return NULL;
46
47 // Possible implementation
48 #if 0
49 // Localtime for WinCE
50 // By martin brown (mpatalberta@yahoo.com)
51 // This is really stupid, converting FILETIME to timeval back and
52 // forth. It assumes FILETIME and DWORDLONG are the same structure
53 // internally.
54
55 TIME_ZONE_INFORMATION pTz;
56
57 const unsigned short int __mon_yday[2][13] =
58 {
59 /* Normal years. */
60 { 0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334, 365 },
61 /* Leap years. */
62 { 0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335, 366 }
63 };
64
65
66 ULARGE_INTEGER _100ns;
67 ::GetTimeZoneInformation(&pTz);
68
69 // FIXME
70 _100ns.QuadPart = (DWORDLONG) *t * 10000 * 1000 /* + ACE_Time_Value::FILETIME_to_timval_skew */;
71 FILETIME file_time;
72 file_time.dwLowDateTime = _100ns.LowPart;
73 file_time.dwHighDateTime = _100ns.HighPart;
74
75 FILETIME localtime;
76 SYSTEMTIME systime;
77 FileTimeToLocalFileTime (&file_time, &localtime);
78 FileTimeToSystemTime (&localtime, &systime);
79
80 res->tm_hour = systime.wHour;
81
82 if(pTz.DaylightBias!=0)
83 {
84 res->tm_isdst = 1;
85 }
86 else
87 {
88 res->tm_isdst = 1;
89 }
90
91 int iLeap;
92 iLeap = (res->tm_year % 4 == 0 && (res->tm_year% 100 != 0 || res->tm_year % 400 == 0));
93 // based on leap select which group to use
94
95 res->tm_mday = systime.wDay;
96 res->tm_min = systime.wMinute;
97 res->tm_mon = systime.wMonth;
98 res->tm_sec = systime.wSecond;
99 res->tm_wday = systime.wDayOfWeek;
100 res->tm_yday = __mon_yday[iLeap][systime.wMonth] + systime.wDay;
101 res->tm_year = systime.wYear;// this the correct year but bias the value to start at the 1900
102 res->tm_year = res->tm_year - 1900;
103
104 return res;
105 #endif
106 }
107
108 time_t __cdecl time(time_t *)
109 {
110 // TODO
111 return 0;
112 }
113
114 size_t __cdecl wcsftime(wchar_t *, size_t, const wchar_t *,
115 const struct tm *)
116 {
117 // TODO
118 return 0;
119 }
120
121 time_t __cdecl mktime(struct tm *)
122 {
123 // TODO
124 return 0;
125 }
126
127 struct tm * __cdecl gmtime(const time_t *)
128 {
129 // TODO
130 return NULL;
131 }
132