• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdeedu API Reference
  • KDE Home
  • Contact Us
 

kstars

  • sources
  • kde-4.12
  • kdeedu
  • kstars
  • kstars
kstarsdatetime.h
Go to the documentation of this file.
1 /***************************************************************************
2  kstarsdatetime.h - K Desktop Planetarium
3  -------------------
4  begin : Tue 05 May 2004
5  copyright : (C) 2001 by Jason Harris
6  email : jharris@30doradus.org
7  ***************************************************************************/
8 
9 /***************************************************************************
10  * *
11  * This program is free software; you can redistribute it and/or modify *
12  * it under the terms of the GNU General Public License as published by *
13  * the Free Software Foundation; either version 2 of the License, or *
14  * (at your option) any later version. *
15  * *
16  ***************************************************************************/
17 
18 #ifndef KSTARSDATETIME_H_
19 #define KSTARSDATETIME_H_
20 
21 #define J2000 2451545.0 //Julian Date for noon on Jan 1, 2000 (epoch J2000)
22 #define B1950 2433282.4235 // Julian date for Jan 0.9235, 1950
23 #define SIDEREALSECOND 1.002737909 //number of sidereal seconds in one solar second
24 
25 #include <kdatetime.h>
26 
27 class dms;
28 
45 class KStarsDateTime : public KDateTime
46 {
47 public:
52  KStarsDateTime();
53 
59  KStarsDateTime( long double djd );
60 
65  KStarsDateTime( const KStarsDateTime &kdt );
66 
71  KStarsDateTime( const KDateTime &kdt );
72 
77  KStarsDateTime( const QDateTime &qdt );
78 
85  KStarsDateTime( const QDate &_d, const QTime &_t );
86 
92  void setDJD( long double jd );
93 
98  void setDate( const QDate &d );
99 
104  void setTime( const QTime &t );
105 
111  KStarsDateTime addSecs( double s ) const;
112 
117  inline KStarsDateTime addDays( int nd ) const { return KStarsDateTime( djd() + (long double)nd ); }
118 
119  inline bool operator == ( const KStarsDateTime &d ) const { return DJD == d.djd(); }
120  inline bool operator != ( const KStarsDateTime &d ) const { return DJD != d.djd(); }
121  inline bool operator < ( const KStarsDateTime &d ) const { return DJD < d.djd(); }
122  inline bool operator <= ( const KStarsDateTime &d ) const { return DJD <= d.djd(); }
123  inline bool operator > ( const KStarsDateTime &d ) const { return DJD > d.djd(); }
124  inline bool operator >= ( const KStarsDateTime &d ) const { return DJD >= d.djd(); }
125 
132  static KStarsDateTime currentDateTime(KDateTime::Spec ts = KDateTime::Spec::ClockTime());
133 
140  static KStarsDateTime fromString( const QString &s );
141 
145  inline long double djd() const { return DJD; }
146 
152  dms gst() const;
153 
158  QTime GSTtoUT( dms GST ) const;
159 
160 
166  inline double epoch() const { return ( double( date().year() )
167  + double( date().dayOfYear() )/double( date().daysInYear() ) ); }
168 
175  bool setFromEpoch( double e );
176 
183  bool setFromEpoch( const QString &e );
184 
185 
186 private:
191  dms GSTat0hUT() const;
192 
193  long double DJD;
194 };
195 
196 #endif //KSTARSDATETIME_H_
197 
KStarsDateTime::fromString
static KStarsDateTime fromString(const QString &s)
Definition: kstarsdatetime.cpp:75
KStarsDateTime::operator==
bool operator==(const KStarsDateTime &d) const
Definition: kstarsdatetime.h:119
KStarsDateTime::GSTtoUT
QTime GSTtoUT(dms GST) const
Convert a given Greenwich Sidereal Time to Universal Time (=Greenwich Mean Time). ...
Definition: kstarsdatetime.cpp:176
KStarsDateTime::addDays
KStarsDateTime addDays(int nd) const
Modify the Date/Time by adding a number of days.
Definition: kstarsdatetime.h:117
KStarsDateTime::epoch
double epoch() const
Definition: kstarsdatetime.h:166
KStarsDateTime::setDate
void setDate(const QDate &d)
Assign the Date according to a QDate object.
Definition: kstarsdatetime.cpp:119
KStarsDateTime::setTime
void setTime(const QTime &t)
Assign the Time according to a QTime object.
Definition: kstarsdatetime.cpp:133
KStarsDateTime::setFromEpoch
bool setFromEpoch(double e)
Set the Date/Time from an epoch value, represented as a double.
Definition: kstarsdatetime.cpp:195
KStarsDateTime::operator>
bool operator>(const KStarsDateTime &d) const
Definition: kstarsdatetime.h:123
KStarsDateTime::operator>=
bool operator>=(const KStarsDateTime &d) const
Definition: kstarsdatetime.h:124
KStarsDateTime::currentDateTime
static KStarsDateTime currentDateTime(KDateTime::Spec ts=KDateTime::Spec::ClockTime())
Definition: kstarsdatetime.cpp:67
KStarsDateTime::djd
long double djd() const
Definition: kstarsdatetime.h:145
KStarsDateTime::addSecs
KStarsDateTime addSecs(double s) const
Definition: kstarsdatetime.cpp:127
KStarsDateTime
Extension of KDateTime for KStars KStarsDateTime can represent the date/time as a Julian Day...
Definition: kstarsdatetime.h:45
dms
An angle, stored as degrees, but expressible in many ways.
Definition: dms.h:42
KDateTime
KStarsDateTime::operator<
bool operator<(const KStarsDateTime &d) const
Definition: kstarsdatetime.h:121
KStarsDateTime::KStarsDateTime
KStarsDateTime()
Default constructor Creates a date/time at J2000 (noon on Jan 1, 200)
Definition: kstarsdatetime.cpp:26
KStarsDateTime::operator!=
bool operator!=(const KStarsDateTime &d) const
Definition: kstarsdatetime.h:120
KStarsDateTime::setDJD
void setDJD(long double jd)
Assign the (long double) Julian Day value, which includes the time of day encoded in the fractional p...
Definition: kstarsdatetime.cpp:99
NaN::d
const double d
Definition: nan.h:35
KStarsDateTime::operator<=
bool operator<=(const KStarsDateTime &d) const
Definition: kstarsdatetime.h:122
KStarsDateTime::gst
dms gst() const
Definition: kstarsdatetime.cpp:138
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:36:20 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

kstars

Skip menu "kstars"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Related Pages

kdeedu API Reference

Skip menu "kdeedu API Reference"
  • Analitza
  •     lib
  • kalgebra
  • kalzium
  •   libscience
  • kanagram
  • kig
  •   lib
  • klettres
  • kstars
  • libkdeedu
  •   keduvocdocument
  • marble
  • parley
  • rocs
  •   App
  •   RocsCore
  •   VisualEditor
  •   stepcore

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal