]> git.saurik.com Git - wxWidgets.git/blobdiff - src/msw/wince/time.cpp
use wxCopyRectToRECT instead of duplicating it
[wxWidgets.git] / src / msw / wince / time.cpp
index 62b10ed256387637131cc43f5c96219b933a7361..6e6915b819b2a3d2bed9ec50448f2ef3b1848b0a 100644 (file)
@@ -2,9 +2,9 @@
 // Name:        src/msw/wince/time.cpp
 // Purpose:     Implements missing time functionality for WinCE
 // Author:      Marco Cavallini (MCK) - wx@koansoftware.com
 // Name:        src/msw/wince/time.cpp
 // Purpose:     Implements missing time functionality for WinCE
 // Author:      Marco Cavallini (MCK) - wx@koansoftware.com
-// Modified by:
+// Modified by: Vadim Zeitlin for VC8 support
 // Created:     31-08-2003
 // Created:     31-08-2003
-// RCS-ID:
+// RCS-ID:      $Id$
 // Copyright:   (c) Marco Cavallini
 // Licence:     wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
 // Copyright:   (c) Marco Cavallini
 // Licence:     wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
 
 #include "wx/msw/wince/time.h"
 
 
 #include "wx/msw/wince/time.h"
 
+#if defined(__VISUALC__) && (__VISUALC__ >= 1400)
+
+// VC8 does provide the time functions but not the standard ones
+#include <altcecrt.h>
+
+time_t __cdecl time(time_t *t)
+{
+    __time64_t t64;
+    if ( !_time64(&t64) )
+        return (time_t)-1;
+
+    if ( t )
+        *t = (time_t)t64;
+
+    return (time_t)t64;
+}
+
+time_t __cdecl mktime(struct tm *t)
+{
+    return (time_t)_mktime64(t);
+}
+
+#else // !VC8
+
 /////////////////////////////////////////////////////////////////////////////////////////////
 //                                                                                         //
 //                             strftime() - taken from OpenBSD                             //
 /////////////////////////////////////////////////////////////////////////////////////////////
 //                                                                                         //
 //                             strftime() - taken from OpenBSD                             //
@@ -445,12 +469,9 @@ label:
                                continue;
                        case 'z':
                                {
                                continue;
                        case 'z':
                                {
-                               int             diff;
+                               int             diff = -timezone;
                                char const *    sign;
 
                                char const *    sign;
 
-                               if (t->tm_isdst < 0)
-                                       continue;
-                continue;
                                if (diff < 0) {
                                        sign = "-";
                                        diff = -diff;
                                if (diff < 0) {
                                        sign = "-";
                                        diff = -diff;
@@ -500,18 +521,22 @@ strftime(char * const s, const size_t maxsize, const char *format, const struct
 extern "C"
 {
 
 extern "C"
 {
 
-size_t wcsftime(wchar_t* const s, const size_t maxsize, const wchar_t *format, const struct tm * const t)
+/* Not needed in VS Studio 2005 */
+
+size_t wcsftime(wchar_t *s,
+                const size_t maxsize,
+                const wchar_t *format,
+                const struct tm *t)
 {
 {
-    char sBuf[256];
-    sBuf[0] = 0;
-    
+    wxCharBuffer sBuf(maxsize/sizeof(wchar_t));
+
     wxString formatStr(format);
     wxCharBuffer bufFormatStr(formatStr.mb_str());
     wxString formatStr(format);
     wxCharBuffer bufFormatStr(formatStr.mb_str());
-    
-    size_t sz = strftime(sBuf, maxsize, bufFormatStr, t);
-    
-    wxMB2WC(s, sBuf, strlen(sBuf));
-    
+
+    size_t sz = strftime(sBuf.data(), maxsize/sizeof(wchar_t), bufFormatStr, t);
+
+    wxMB2WC(s, sBuf, maxsize);
+
     return sz;
 }
 
     return sz;
 }
 
@@ -734,4 +759,4 @@ time_t __cdecl mktime(struct tm *t)
 
 } // extern "C"
 
 
 } // extern "C"
 
-
+#endif // VC8/!VC8