Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members

astro::Date Class Reference

#include <astro.h>

List of all members.

Public Member Functions

 Date (double)
 Date (int Y, int M, int D)
 Date ()
 operator double () const

Public Attributes

int day
int hour
int minute
int month
double seconds
int year


Constructor & Destructor Documentation

astro::Date::Date  ) 
 

Definition at line 325 of file astro.cpp.

References day, hour, minute, month, seconds, and year.

00326 {
00327     year = 0;
00328     month = 0;
00329     day = 0;
00330     hour = 0;
00331     minute = 0;
00332     seconds = 0.0;
00333 }

astro::Date::Date int  Y,
int  M,
int  D
 

Definition at line 335 of file astro.cpp.

References day, hour, minute, month, seconds, and year.

00336 {
00337     year = Y;
00338     month = M;
00339     day = D;
00340     hour = 0;
00341     minute = 0;
00342     seconds = 0.0;
00343 }

astro::Date::Date double   ) 
 

Definition at line 346 of file astro.cpp.

References day, hour, minute, month, seconds, and year.

00347 {
00348     int a = (int) (jd + 0.5);
00349     double c;
00350     if (a < 2299161)
00351     {
00352         c = a + 1524;
00353     }
00354     else
00355     {
00356         double b = (int) ((a - 1867216.25) / 36524.25);
00357         c = a + b - (int) (b / 4) + 1525;
00358     }
00359 
00360     int d = (int) ((c - 122.1) / 365.25);
00361     int e = (int) (365.25 * d);
00362     int f = (int) ((c - e) / 30.6001);
00363 
00364     double dday = c - e - (int) (30.6001 * f) + ((jd + 0.5) - (int) (jd + 0.5));
00365 
00366     /* This following used to be 14.0, but gcc was computing it incorrectly, so
00367        it was changed to 14 */
00368     month = f - 1 - 12 * (int) (f / 14);
00369     year = d - 4715 - (int) ((7.0 + month) / 10.0);
00370     day = (int) dday;
00371     
00372     double dhour = (dday - day) * 24;
00373     hour = (int) dhour;
00374 
00375     double dminute = (dhour - hour) * 60;
00376     minute = (int) dminute;
00377 
00378     seconds = (dminute - minute) * 60;
00379 }


Member Function Documentation

astro::Date::operator double  )  const
 

Definition at line 383 of file astro.cpp.

References B, day, hour, minute, month, seconds, and year.

00384 {
00385     int y = year, m = month;
00386     if (month <= 2)
00387     {
00388         y = year - 1;
00389         m = month + 12;
00390     }
00391 
00392     // Correct for the lost days in Oct 1582 when the Gregorian calendar
00393     // replaced the Julian calendar.
00394     int B = -2;
00395     if (year > 1582 || (year == 1582 && (month > 10 || (month == 10 && day >= 15))))
00396     {
00397         B = y / 400 - y / 100;
00398     }
00399 
00400     return (floor(365.25 * y) +
00401             floor(30.6001 * (m + 1)) + B + 1720996.5 +
00402             day + hour / 24.0 + minute / 1440.0 + seconds / 86400.0);
00403 }


Member Data Documentation

int astro::Date::day
 

Definition at line 39 of file astro.h.

Referenced by celestia_fromjulianday(), Date(), DatePicker::decrementField(), eclipseCompute(), DatePicker::getSystemTime(), KdePreferencesDialog::getTime(), DatePicker::incrementField(), InitDateControls(), DatePicker::keyDown(), SetTimeDialog::notify(), DatePicker::notifyDateChanged(), operator double(), operator<<(), CommandParser::parseCommand(), DatePicker::redraw(), CelestiaCore::renderOverlay(), DatePicker::setSystemTime(), KdePreferencesDialog::setTime(), KdePreferencesDialog::slotApply(), SetTimeDialog::updateControls(), and Url::Url().

int astro::Date::hour
 

Definition at line 40 of file astro.h.

Referenced by celestia_fromjulianday(), celestia_tojulianday(), Date(), eclipseCompute(), eclipseGoto(), KdePreferencesDialog::getTime(), SetTimeDialog::notify(), operator double(), operator<<(), CommandParser::parseCommand(), CelestiaCore::renderOverlay(), KdePreferencesDialog::setTime(), KdePreferencesDialog::slotApply(), SetTimeDialog::updateControls(), and Url::Url().

int astro::Date::minute
 

Definition at line 41 of file astro.h.

Referenced by celestia_fromjulianday(), celestia_tojulianday(), Date(), eclipseCompute(), eclipseGoto(), KdePreferencesDialog::getTime(), SetTimeDialog::notify(), operator double(), operator<<(), CommandParser::parseCommand(), CelestiaCore::renderOverlay(), KdePreferencesDialog::setTime(), KdePreferencesDialog::slotApply(), SetTimeDialog::updateControls(), and Url::Url().

int astro::Date::month
 

Definition at line 38 of file astro.h.

Referenced by celestia_fromjulianday(), Date(), DatePicker::decrementField(), eclipseCompute(), DatePicker::getSystemTime(), KdePreferencesDialog::getTime(), DatePicker::incrementField(), InitDateControls(), DatePicker::keyDown(), SetTimeDialog::notify(), DatePicker::notifyDateChanged(), operator double(), operator<<(), CommandParser::parseCommand(), DatePicker::redraw(), CelestiaCore::renderOverlay(), DatePicker::setSystemTime(), KdePreferencesDialog::setTime(), KdePreferencesDialog::slotApply(), SetTimeDialog::updateControls(), and Url::Url().

double astro::Date::seconds
 

Definition at line 42 of file astro.h.

Referenced by celestia_fromjulianday(), celestia_tojulianday(), Date(), eclipseCompute(), eclipseGoto(), KdePreferencesDialog::getTime(), SetTimeDialog::notify(), operator double(), operator<<(), CommandParser::parseCommand(), CelestiaCore::renderOverlay(), KdePreferencesDialog::setTime(), KdePreferencesDialog::slotApply(), SetTimeDialog::updateControls(), and Url::Url().

int astro::Date::year
 

Definition at line 37 of file astro.h.

Referenced by celestia_fromjulianday(), Date(), DatePicker::decrementField(), eclipseCompute(), DatePicker::getSystemTime(), KdePreferencesDialog::getTime(), DatePicker::incrementField(), InitDateControls(), DatePicker::keyDown(), SetTimeDialog::notify(), DatePicker::notifyDateChanged(), operator double(), operator<<(), CommandParser::parseCommand(), DatePicker::redraw(), CelestiaCore::renderOverlay(), DatePicker::setSystemTime(), KdePreferencesDialog::setTime(), KdePreferencesDialog::slotApply(), SetTimeDialog::updateControls(), and Url::Url().


The documentation for this class was generated from the following files:
Generated on Sat Jan 14 22:33:44 2006 for Celestia by  doxygen 1.4.1