]>
Commit | Line | Data |
---|---|---|
1c193821 JS |
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 | |
9ed0d735 | 32 | #include "wx/msw/wrapwin.h" |
1c193821 JS |
33 | #endif |
34 | ||
35 | #include "wx/msw/wince/time.h" | |
36 | ||
37 | long timezone = 0; | |
38 | ||
39 | // Hint: use GetSystemTime() | |
40 | ||
4676948b | 41 | struct tm * __cdecl localtime(const time_t *) |
1c193821 JS |
42 | { |
43 | // TODO | |
44 | return NULL; | |
45 | ||
46 | // Possible implementation | |
47 | #if 0 | |
48 | // Localtime for WinCE | |
49 | // By martin brown (mpatalberta@yahoo.com) | |
50 | // This is really stupid, converting FILETIME to timeval back and | |
51 | // forth. It assumes FILETIME and DWORDLONG are the same structure | |
52 | // internally. | |
53 | ||
54 | TIME_ZONE_INFORMATION pTz; | |
55 | ||
56 | const unsigned short int __mon_yday[2][13] = | |
57 | { | |
58 | /* Normal years. */ | |
59 | { 0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334, 365 }, | |
60 | /* Leap years. */ | |
61 | { 0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335, 366 } | |
62 | }; | |
63 | ||
64 | ||
65 | ULARGE_INTEGER _100ns; | |
66 | ::GetTimeZoneInformation(&pTz); | |
67 | ||
68 | // FIXME | |
69 | _100ns.QuadPart = (DWORDLONG) *t * 10000 * 1000 /* + ACE_Time_Value::FILETIME_to_timval_skew */; | |
70 | FILETIME file_time; | |
71 | file_time.dwLowDateTime = _100ns.LowPart; | |
72 | file_time.dwHighDateTime = _100ns.HighPart; | |
73 | ||
74 | FILETIME localtime; | |
75 | SYSTEMTIME systime; | |
76 | FileTimeToLocalFileTime (&file_time, &localtime); | |
77 | FileTimeToSystemTime (&localtime, &systime); | |
78 | ||
79 | res->tm_hour = systime.wHour; | |
80 | ||
81 | if(pTz.DaylightBias!=0) | |
82 | { | |
83 | res->tm_isdst = 1; | |
84 | } | |
85 | else | |
86 | { | |
87 | res->tm_isdst = 1; | |
88 | } | |
89 | ||
90 | int iLeap; | |
91 | iLeap = (res->tm_year % 4 == 0 && (res->tm_year% 100 != 0 || res->tm_year % 400 == 0)); | |
92 | // based on leap select which group to use | |
93 | ||
94 | res->tm_mday = systime.wDay; | |
95 | res->tm_min = systime.wMinute; | |
96 | res->tm_mon = systime.wMonth; | |
97 | res->tm_sec = systime.wSecond; | |
98 | res->tm_wday = systime.wDayOfWeek; | |
99 | res->tm_yday = __mon_yday[iLeap][systime.wMonth] + systime.wDay; | |
100 | res->tm_year = systime.wYear;// this the correct year but bias the value to start at the 1900 | |
101 | res->tm_year = res->tm_year - 1900; | |
102 | ||
103 | return res; | |
104 | #endif | |
105 | } | |
106 | ||
4676948b | 107 | time_t __cdecl time(time_t *) |
1c193821 JS |
108 | { |
109 | // TODO | |
110 | return 0; | |
111 | } | |
112 | ||
4676948b | 113 | size_t __cdecl wcsftime(wchar_t *, size_t, const wchar_t *, |
1c193821 JS |
114 | const struct tm *) |
115 | { | |
116 | // TODO | |
117 | return 0; | |
118 | } | |
119 | ||
4676948b | 120 | time_t __cdecl mktime(struct tm *) |
1c193821 JS |
121 | { |
122 | // TODO | |
123 | return 0; | |
124 | } | |
125 | ||
4676948b | 126 | struct tm * __cdecl gmtime(const time_t *) |
1c193821 JS |
127 | { |
128 | // TODO | |
129 | return NULL; | |
130 | } | |
131 |