summaryrefslogtreecommitdiff
path: root/libopie/pim/otimezone.h
authorzecke <zecke>2003-02-21 16:52:49 (UTC)
committer zecke <zecke>2003-02-21 16:52:49 (UTC)
commit0bb9d0f9e7da80f0ae3b91d4ebbb7aab4d2b9df7 (patch) (side-by-side diff)
treef3ce9c9441a1073762f3e0c61cc85f0d5a1fd81d /libopie/pim/otimezone.h
parenta298235aa1489937e7657079e6352adfc8746acf (diff)
downloadopie-0bb9d0f9e7da80f0ae3b91d4ebbb7aab4d2b9df7.zip
opie-0bb9d0f9e7da80f0ae3b91d4ebbb7aab4d2b9df7.tar.gz
opie-0bb9d0f9e7da80f0ae3b91d4ebbb7aab4d2b9df7.tar.bz2
-Remove old Todo classes they're deprecated and today I already using the
new API -Guard against self assignment in OTodo -Add test apps for OPIM -Opiefied Event classes -Added TimeZone handling and pinning of TimeZones to OEvent -Adjust ORecur and the widget to better timezone behaviour
Diffstat (limited to 'libopie/pim/otimezone.h') (more/less context) (ignore whitespace changes)
-rw-r--r--libopie/pim/otimezone.h71
1 files changed, 71 insertions, 0 deletions
diff --git a/libopie/pim/otimezone.h b/libopie/pim/otimezone.h
new file mode 100644
index 0000000..bb08349
--- a/dev/null
+++ b/libopie/pim/otimezone.h
@@ -0,0 +1,71 @@
+#ifndef OPIE_TIME_ZONE_H
+#define OPIE_TIME_ZONE_H
+
+#include <time.h>
+#include <qdatetime.h>
+
+/**
+ * A very primitive class to convert time
+ * from one timezone to another
+ * and to localtime
+ * and time_t
+ */
+class OTimeZone {
+ public:
+ typedef QString ZoneName;
+ OTimeZone( const ZoneName& = ZoneName::null );
+ virtual ~OTimeZone(); // just in case.
+
+ bool isValid()const;
+
+ /**
+ * converts the QDateTime to a DateTime
+ * in the local timezone
+ * if QDateTime is 25th Jan and takes place in Europe/Berlin at 12h
+ * and the current timezone is Europe/London the returned
+ * time will be 11h.
+ */
+ QDateTime toLocalDateTime( const QDateTime& dt );
+
+ /**
+ * converts the QDateTime to UTC time
+ */
+ QDateTime toUTCDateTime( const QDateTime& dt );
+
+ /**
+ * reads the time_t into a QDateTime using UTC as timezone!
+ */
+ QDateTime fromUTCDateTime( time_t );
+
+ /**
+ * converts the time_t to the time in the timezone
+ */
+ QDateTime toDateTime( time_t );
+
+ /**
+ * converts the QDateTime from one timezone to this timeZone
+ */
+ QDateTime toDateTime( const QDateTime&, const OTimeZone& timeZone );
+
+ /**
+ * converts the date time into a time_t. It takes the timezone into account
+ */
+ time_t fromDateTime( const QDateTime& );
+
+ /**
+ * converts the datetime with timezone UTC
+ */
+ time_t fromUTCDateTime( const QDateTime& );
+
+ static OTimeZone current();
+ static OTimeZone utc();
+
+ QString timeZone()const;
+ private:
+ ZoneName m_name;
+ class Private;
+ Private* d;
+};
+
+
+#endif