git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@45573
c3d73ce0-8a6f-49c7-b76d-
6d57e0e08775
// thread local storage for localtime anyway.
wxMutexLocker locker(timeLock);
#endif
// thread local storage for localtime anyway.
wxMutexLocker locker(timeLock);
#endif
- memcpy(temp, localtime(ticks), sizeof(struct tm));
+
+ // Borland CRT crashes when passed 0 ticks for some reason, see SF bug 1704438
+#ifdef __BORLANDC__
+ if ( !*ticks )
+ return NULL;
+#endif
+
+ const tm * const t = localtime(ticks);
+ if ( !t )
+ return NULL;
+
+ memcpy(temp, t, sizeof(struct tm));
return temp;
}
#endif // !HAVE_LOCALTIME_R
return temp;
}
#endif // !HAVE_LOCALTIME_R
// using thread local storage for gmtime anyway.
wxMutexLocker locker(timeLock);
#endif
// using thread local storage for gmtime anyway.
wxMutexLocker locker(timeLock);
#endif
+
+#ifdef __BORLANDC__
+ if ( !*ticks )
+ return NULL;
+#endif
+
+ const tm * const t = gmtime(ticks);
+ if ( !t )
+ return NULL;
+
memcpy(temp, gmtime(ticks), sizeof(struct tm));
return temp;
}
memcpy(temp, gmtime(ticks), sizeof(struct tm));
return temp;
}