#1981 [patch] fix inconsistent time_t

WSL
assigned
None
Bug
none
Unknown
False
2013-06-04
2013-06-04
mark
No

mingwrt 4.0-1-mingw32-rc-2

wchar.h can define time_t differently than time.h or types.h. This patch makes them consistent:

diff --git a/include/wchar.h b/include/wchar.h
index 0624d30..5a58b10 100644
--- a/include/wchar.h
+++ b/include/wchar.h
@@ -83,9 +83,25 @@ typedef struct _iobuf
} FILE;
#endif /* Not _FILE_DEFINED */

-#ifndef _TIME_T_DEFINED  /* Also in time.h */
-typedef long time_t;
-#define _TIME_T_DEFINED
+/* Also in time.h */
+#ifndef _TIME32_T_DEFINED
+typedef __int32 __time32_t;
+#define _TIME32_T_DEFINED
+#endif
+
+#ifndef _TIME64_T_DEFINED
+/* A 64-bit time_t to get to Y3K */
+typedef __int64 __time64_t;
+#define _TIME64_T_DEFINED
+#endif
+
+#ifndef _TIME_T_DEFINED
+# if defined(_USE_32BIT_TIME_T) && defined(_HAVE_32BIT_TIME_T)
+   typedef        __time32_t time_t;
+# else
+   typedef        __time64_t time_t;
+# endif /* _USE_32BIT_TIME_T */
+# define _TIME_T_DEFINED
#endif

Discussion

  • Earnie Boyd

    Earnie Boyd - 2013-06-04
    • status: unread --> assigned
    • assigned_to: Earnie Boyd
     
  • Earnie Boyd

    Earnie Boyd - 2013-06-04

    I've been reworking time_t and other related issues. So this may have already changed. Wait until I've pushed the repository and redo your patch after that time. Also, a patch more than 1 line is preferred as an attached file.

     

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks