1. wxDir works for MSW and documented

2. wxDateTime works with dates very close to the Epoch
3. setting font for wxRadioBox works


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@4899 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
1999-12-11 00:43:59 +00:00
parent 6bfd5671b0
commit 4afd752902
10 changed files with 204 additions and 39 deletions

View File

@@ -553,9 +553,25 @@ wxDateTime& wxDateTime::Set(const struct tm& tm)
struct tm tm2(tm);
time_t timet = mktime(&tm2);
if ( timet == (time_t)(-1) )
if ( timet == (time_t)-1 )
{
wxFAIL_MSG(_T("Invalid time"));
// mktime() rather unintuitively fails for Jan 1, 1970 if the hour is
// less than timezone - try to make it work for this case
if ( tm2.tm_year == 70 && tm2.tm_mon == 0 && tm2.tm_mday == 1 )
{
// add timezone to make sure that date is in range
tm2.tm_sec -= GetTimeZone();
timet = mktime(&tm2);
if ( timet != (time_t)-1 )
{
timet += GetTimeZone();
return Set(timet);
}
}
wxFAIL_MSG( _T("mktime() failed") );
return ms_InvDateTime;
}