fixed bug in wxDateTime::Set(jdn) when DST was in effect

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@27983 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2004-06-23 21:53:15 +00:00
parent ccd6aacd5d
commit 8cc00d5fca
2 changed files with 14 additions and 2 deletions

View File

@@ -1287,6 +1287,17 @@ wxDateTime& wxDateTime::Set(double jdn)
jdn *= MILLISECONDS_PER_DAY;
// JDNs always suppose an UTC date, so bring it back to local time zone
// (also see GetJulianDayNumber() implementation)
long tzDiff = GetTimeZone();
if ( IsDST() == 1 )
{
// FIXME: again, we suppose that DST is always one hour
tzDiff -= 3600;
}
jdn += tzDiff*1000; // tzDiff is in seconds
m_time.Assign(jdn);
return *this;
@@ -1904,8 +1915,8 @@ wxDateTime& wxDateTime::SetToYearDay(wxDateTime::wxDateTime_t yday)
double wxDateTime::GetJulianDayNumber() const
{
// JDN are always expressed for the GMT dates
Tm tm(ToTimezone(GMT0).GetTm(GMT0));
// JDN are always expressed for the UTC dates
Tm tm(ToTimezone(UTC).GetTm(UTC));
double result = GetTruncatedJDN(tm.mday, tm.mon, tm.year);