[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    KDE/kdepim/kresources/slox
From:       Will Stephenson <lists () stevello ! free-online ! co ! uk>
Date:       2005-07-21 14:45:11
Message-ID: 1121957111.714819.22501.nullmailer () svn ! kde ! org
[Download RAW message or body]

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 <stdlib.h>
+
 #include <libkcal/incidence.h>
 
 #include <libkdepim/kpimprefs.h>
@@ -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";
 }


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic