author | zecke <zecke> | 2004-07-29 19:42:59 (UTC) |
---|---|---|
committer | zecke <zecke> | 2004-07-29 19:42:59 (UTC) |
commit | 52b1ae9281920cf5a40fe543112d8b00e7699ef6 (patch) (side-by-side diff) | |
tree | 0b0a79ff9a45a66f32fe555ee662b4acc8f6eff9 /libopie2/opiepim/core/opimtimezone.cpp | |
parent | c170d1f931ae03c2ec917b7abf4bd5d0e94a3760 (diff) | |
download | opie-52b1ae9281920cf5a40fe543112d8b00e7699ef6.zip opie-52b1ae9281920cf5a40fe543112d8b00e7699ef6.tar.gz opie-52b1ae9281920cf5a40fe543112d8b00e7699ef6.tar.bz2 |
-UTC -> Europe/London when referring to no timezone
-special handling for allDay Event in OPImEvent, avoid setting timezone
as it is by default UTC
-No timezone set by default for an Event
-Recurrence is UTC (no timezone)
-Provide upgrade path from DateBook as by default events were in the current timezone but didn't have the timezone attribute
-unified handling of timezones, compatible with QtopiaDesktop
-do less conversions
-...
Diffstat (limited to 'libopie2/opiepim/core/opimtimezone.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | libopie2/opiepim/core/opimtimezone.cpp | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/libopie2/opiepim/core/opimtimezone.cpp b/libopie2/opiepim/core/opimtimezone.cpp index fefceb5..5b32b1f 100644 --- a/libopie2/opiepim/core/opimtimezone.cpp +++ b/libopie2/opiepim/core/opimtimezone.cpp @@ -47,8 +47,9 @@ QDateTime utcTime( time_t t ) ret.setDate( QDate( broken->tm_year + 1900, broken->tm_mon + 1, broken->tm_mday ) ); ret.setTime( QTime( broken->tm_hour, broken->tm_min, broken->tm_sec ) ); return ret; } + QDateTime utcTime( time_t t, const QString& zone ) { QCString org = ::getenv( "TZ" ); #ifndef Q_OS_MACX // Following line causes bus errors on Mac @@ -69,8 +70,10 @@ QDateTime utcTime( time_t t, const QString& zone ) ret.setTime( QTime( broken->tm_hour, broken->tm_min, broken->tm_sec ) ); return ret; } + + time_t to_Time_t( const QDateTime& utc, const QString& str ) { QDate d = utc.date(); QTime t = utc.time(); @@ -150,11 +153,10 @@ QDateTime OPimTimeZone::toDateTime( time_t t ) * convert utc -> timeZoneDT using this->m_name */ QDateTime OPimTimeZone::toDateTime( const QDateTime& dt, const OPimTimeZone& zone ) { - time_t utc = to_Time_t( dt, zone.m_name ); - owarn << "" << utc << " " << zone.m_name << "" << oendl; - return utcTime( utc, m_name ); + time_t utc = to_Time_t( dt, m_name ); + return utcTime( utc, zone.m_name ); } time_t OPimTimeZone::fromDateTime( const QDateTime& time ) @@ -164,9 +166,9 @@ time_t OPimTimeZone::fromDateTime( const QDateTime& time ) time_t OPimTimeZone::fromUTCDateTime( const QDateTime& time ) { - return to_Time_t( time, "UTC" ); + return to_Time_t( time, "Europe/London" ); } OPimTimeZone OPimTimeZone::current() @@ -178,9 +180,9 @@ OPimTimeZone OPimTimeZone::current() OPimTimeZone OPimTimeZone::utc() { - return OPimTimeZone( "UTC" ); + return OPimTimeZone( "Europe/London" ); } QString OPimTimeZone::timeZone() const |