summaryrefslogtreecommitdiffstats
path: root/kweather/sun.h
diff options
context:
space:
mode:
authortoma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-11-25 17:56:58 +0000
committertoma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-11-25 17:56:58 +0000
commitae2a03c2941bf92573f89b88ef73f8aa842bea0a (patch)
tree3566563f3fb6ac3cb3496669d8f233062d3091bc /kweather/sun.h
downloadtdetoys-ae2a03c2941bf92573f89b88ef73f8aa842bea0a.tar.gz
tdetoys-ae2a03c2941bf92573f89b88ef73f8aa842bea0a.zip
Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features.
BUG:215923 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdetoys@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kweather/sun.h')
-rw-r--r--kweather/sun.h57
1 files changed, 57 insertions, 0 deletions
diff --git a/kweather/sun.h b/kweather/sun.h
new file mode 100644
index 0000000..6773d01
--- /dev/null
+++ b/kweather/sun.h
@@ -0,0 +1,57 @@
+/***************************************************************************
+ sun.h - Sun Rise and Set Calculations
+ -------------------
+ begin : Friday July 11 2003
+ copyright : (C) 2003 by John Ratke
+ email : jratke@comcast.net
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#ifndef SUN_H
+#define SUN_H
+
+#include <qstring.h>
+#include <qdatetime.h>
+#include <krfcdate.h>
+
+class Sun
+{
+ public:
+ /* Constructs a Sun instance for calculating sun rise and set
+ * times. Users should construct it once and then call one or
+ * more of the other four public functions.
+ *
+ * Inputs are the location on earth to calculate the rise/set time
+ * for (for example, the location of a particular weather station),
+ * the current date, and the offset in minutes from universal time
+ * to the local time zone.
+ *
+ */
+ Sun( const QString &latitude,
+ const QString &longitude,
+ QDate date = QDate::currentDate(),
+ const int localUTCOffset = KRFCDate::localUTCOffset() );
+
+ QTime computeRiseTime();
+ QTime computeSetTime();
+ QTime computeCivilTwilightStart();
+ QTime computeCivilTwilightEnd();
+
+ private:
+ QTime convertDoubleToLocalTime( const double time );
+
+ const QDate m_date;
+ const double m_lat;
+ const double m_lon;
+ const int m_localUTCOffset;
+};
+
+#endif