SVN commit 437323 by wstephens: Save things to the server in the correct timezone - remove a double conversion bug. M +12 -1 webdavhandler.cpp --- trunk/KDE/kdepim/kresources/slox/webdavhandler.cpp #437322:437323 @@ -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"; }