You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by gw...@apache.org on 2007/01/09 16:52:41 UTC
svn commit: r494441 -
/incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/SDODate.cpp
Author: gwinn
Date: Tue Jan 9 07:52:39 2007
New Revision: 494441
URL: http://svn.apache.org/viewvc?view=rev&rev=494441
Log:
Make localtime a platform specific macro with an option to override
Modified:
incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/SDODate.cpp
Modified: incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/SDODate.cpp
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/SDODate.cpp?view=diff&rev=494441&r1=494440&r2=494441
==============================================================================
--- incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/SDODate.cpp (original)
+++ incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/SDODate.cpp Tue Jan 9 07:52:39 2007
@@ -21,6 +21,21 @@
#include "commonj/sdo/SDODate.h"
+// According to Linux, localtime_r is defined as
+// struct tm *localtime_r(const time_t *timep, struct tm *result);
+// However, Windows doesn't have localtime_r, and actually varies what it does
+// have across dfferent versions. To accommodate this we use a macro that
+// resolves to the correct settings on linux and MS VC8. For other platforms
+// it will be necessary to modify this file or override the macro with a -D
+// option on the compile line.
+#ifndef tuscany_localtime_r
+#if defined(WIN32) || defined (_WINDOWS)
+ #define tuscany_localtime_r(value, tmp_tm) localtime_s(&tmp_tm, &value);
+#else
+ #define tuscany_localtime_r(value, tmp_tm) localtime_r(&value, &tmp_tm);
+#endif
+#endif
+
namespace commonj{
namespace sdo{
@@ -47,11 +62,8 @@
{
struct tm tmp_tm;
-#if defined(WIN32) || defined (_WINDOWS)
- localtime_s(&tmp_tm, &value);
-#else
- localtime_r(&value, &tmp_tm);
-#endif
+ tuscany_localtime_r(value, tmp_tm);
+
return asctime(&tmp_tm);
}
---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-commits-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-commits-help@ws.apache.org