From kde-commits Thu Jul 21 15:06:17 2005 From: Will Stephenson Date: Thu, 21 Jul 2005 15:06:17 +0000 To: kde-commits Subject: branches/KDE/3.4/kdepim/kresources/slox Message-Id: <1121958377.152732.23127.nullmailer () svn ! kde ! org> X-MARC-Message: https://marc.info/?l=kde-commits&m=112195840509717 SVN commit 437333 by wstephens: Backport fix for offset SLOX appointments M +12 -1 webdavhandler.cpp --- branches/KDE/3.4/kdepim/kresources/slox/webdavhandler.cpp #437332:437333 @@ -28,6 +28,8 @@ #endif #endif +#include + #include #include @@ -150,7 +152,16 @@ { QDateTime utc = KPimPrefs::localTimeToUtc( dt, timeZoneId ); - uint ticks = -utc.secsTo( QDateTime( QDate( 1970, 1, 1 ), QTime( 0, 0 ) ) ); + // secsTo and toTime_t etc also perform a timezone conversion using the system timezone, + // but we want to use the calendar timezone, so we have to convert ourself and spoof the tz to UTC before + // converting to ticks to prevent this + QCString origTz = getenv("TZ"); + setenv( "TZ", "UTC", 1 ); + uint ticks = utc.toTime_t(); + if ( origTz.isNull() ) + unsetenv( "TZ" ); + else + setenv( "TZ", origTz, 1 ); return QString::number( ticks ) + "000"; }