Index: src/platform-posix.cc |
=================================================================== |
--- src/platform-posix.cc (revision 2600) |
+++ src/platform-posix.cc (working copy) |
@@ -86,16 +86,20 @@ |
} |
-char* OS::LocalTimezone(double time) { |
+const char* OS::LocalTimezone(double time) { |
+ ASSERT(!isnan(time)); |
time_t tv = static_cast<time_t>(floor(time/msPerSecond)); |
struct tm* t = localtime(&tv); |
- return const_cast<char*>(t->tm_zone); |
+ if (NULL == t) return ""; |
+ return t->tm_zone; |
} |
double OS::DaylightSavingsOffset(double time) { |
+ ASSERT(!isnan(time)); |
time_t tv = static_cast<time_t>(floor(time/msPerSecond)); |
struct tm* t = localtime(&tv); |
+ if (NULL == t) return nan_value(); |
return t->tm_isdst > 0 ? 3600 * msPerSecond : 0; |
} |