A class to represent the simulated local time, time zone, and daylight savings time observation. More...
#include <LocalTime.h>
Public Member Functions | |
| LocalTime () | |
| Default constructor. | |
| virtual | ~LocalTime () |
| Destructor. | |
| void | SetFromEpochSeconds (time_t time) |
Populates the LocalTime class based on epoch seconds (ie, as returned from time(NULL) ). | |
| void | SetYear (int year) |
| Set the calendar year to simulate. | |
| int | GetYear () const |
| Retrieves the Gregorian calendar year. | |
| void | SetMonth (int month) |
| Sets the calendar month to simulate. | |
| int | GetMonth () const |
| Retrieves the calendar month (1-12). | |
| void | SetDay (int day) |
| Sets the day of the month to simulate. | |
| int | GetDay () const |
| Retrieves the day of the month (1-31). | |
| void | SetHour (int hour) |
| Sets the hour of day to simulate. | |
| int | GetHour () const |
| Retrieves the hour of day (0-23). | |
| void | SetMinutes (int minutes) |
| Sets the minute of the hour to simulate. | |
| int | GetMinutes () const |
| Retrieves the minute of the hour (0-59). | |
| void | SetSeconds (double seconds) |
| Sets the second of the minute to simulate. | |
| double | GetSeconds () const |
| Retrieves the second of the minute (0-59). | |
| void | SetObservingDaylightSavingsTime (bool inDST) |
| Sets if Daylight Savings Time is currently observed in the simulation. | |
| bool | GetObservingDaylightSavingsTime () const |
| Retrieves if daylight savings time is observed in the simulation. | |
| void | SetTimeZone (double zone) |
| Specifies the time zone being simulated. | |
| double | GetTimeZone () const |
| Retrieves the currently simulated time zone. | |
| double | GetJulianDate (bool terrestrialTime) const |
| Retrieves the Julian Date that this LocalTime object represents. | |
| double | GetEpoch2000Centuries (bool terrestrialTime) const |
| Obtains centuries and fraction since January 1, 2000 represented by this object. | |
| double | GetEpoch1990Days (bool terrestrialTime) const |
| Obtains days elapsed since January 1, 1990 represented by this object on the Julian calendar. | |
| void | SetFromSystemTime () |
| Populate the object based on the system's current local time settings. | |
| void | AddSeconds (long seconds) |
| Add the given number of seconds to the time represented by this object. | |
| bool | Serialize (std::ostream &stream) |
| Flattens this object and everything in it to a stream buffer. | |
| bool | Unserialize (std::istream &stream) |
| Restores this object from the stream created using Serialize(). | |
A class to represent the simulated local time, time zone, and daylight savings time observation.
LocalTime objects are passed into AtmosphericConditions::SetTime() to change the simulated time of day. Be sure that your Location object represents a location consistent with the time zone you have specified as well.
| SilverLining::LocalTime::LocalTime | ( | ) |
Default constructor.
Creates a local time with default settings (read from the SilverLining.config file if constructed after calling Atmosphere::Initialize()).
| virtual SilverLining::LocalTime::~LocalTime | ( | ) | [inline, virtual] |
Destructor.
| void SilverLining::LocalTime::AddSeconds | ( | long | seconds | ) |
Add the given number of seconds to the time represented by this object.
| int SilverLining::LocalTime::GetDay | ( | ) | const [inline] |
Retrieves the day of the month (1-31).
| double SilverLining::LocalTime::GetEpoch1990Days | ( | bool | terrestrialTime | ) | const |
Obtains days elapsed since January 1, 1990 represented by this object on the Julian calendar.
Used for internal astronomical calculations. Since this number is smaller than that returned by GetJulianDate(), it is of higher precision.
| terrestrialTime | Specifying terrestrial time means you want atomic clock time, not corrected by leap seconds to account for slowing of the Earth's rotation, as opposed to GMT which does account for leap seconds. |
| double SilverLining::LocalTime::GetEpoch2000Centuries | ( | bool | terrestrialTime | ) | const |
Obtains centuries and fraction since January 1, 2000 represented by this object.
Used for internal astronomical calculations. Since this number is smaller than that returned by GetJulianDate(), it is of higher precision.
| terrestrialTime | Specifying terrestrial time means you want atomic clock time, not corrected by leap seconds to account for slowing of the Earth's rotation, as opposed to GMT which does account for leap seconds. |
| int SilverLining::LocalTime::GetHour | ( | ) | const [inline] |
Retrieves the hour of day (0-23).
| double SilverLining::LocalTime::GetJulianDate | ( | bool | terrestrialTime | ) | const |
Retrieves the Julian Date that this LocalTime object represents.
Julian Dates are used for astronomical calculations (such as our own ephemeris model) and represent days and fractions since noon Universal Time on January 1, 4713 BCE on the Julian calendar. Note that due to precision limitations of 64-bit doubles, the resolution of the date returned may be as low as within 8 hours.
| terrestrialTime | Specifying terrestrial time means you want atomic clock time, not corrected by leap seconds to account for slowing of the Earth's rotation, as opposed to GMT which does account for leap seconds. |
| int SilverLining::LocalTime::GetMinutes | ( | ) | const [inline] |
Retrieves the minute of the hour (0-59).
| int SilverLining::LocalTime::GetMonth | ( | ) | const [inline] |
Retrieves the calendar month (1-12).
| bool SilverLining::LocalTime::GetObservingDaylightSavingsTime | ( | ) | const [inline] |
Retrieves if daylight savings time is observed in the simulation.
| double SilverLining::LocalTime::GetSeconds | ( | ) | const [inline] |
Retrieves the second of the minute (0-59).
| double SilverLining::LocalTime::GetTimeZone | ( | ) | const [inline] |
Retrieves the currently simulated time zone.
| int SilverLining::LocalTime::GetYear | ( | ) | const [inline] |
Retrieves the Gregorian calendar year.
| bool SilverLining::LocalTime::Serialize | ( | std::ostream & | stream | ) |
Flattens this object and everything in it to a stream buffer.
| void SilverLining::LocalTime::SetDay | ( | int | day | ) | [inline] |
Sets the day of the month to simulate.
| day | The day of month, ranging from 1-31. |
| void SilverLining::LocalTime::SetFromEpochSeconds | ( | time_t | time | ) |
Populates the LocalTime class based on epoch seconds (ie, as returned from time(NULL) ).
Internally, it calls gmtime() on the value passed in, and populates the class based on the its results. The time zone will be set to GMT.
| time | Seconds elapsed since midnight, January 1, 1970 UTC. |
| void SilverLining::LocalTime::SetFromSystemTime | ( | ) |
Populate the object based on the system's current local time settings.
| void SilverLining::LocalTime::SetHour | ( | int | hour | ) | [inline] |
Sets the hour of day to simulate.
| hour | The hour of day, ranging from 0-23 (0=midnight, 12=noon, 23=11PM) |
| void SilverLining::LocalTime::SetMinutes | ( | int | minutes | ) | [inline] |
Sets the minute of the hour to simulate.
| minutes | Minutes from 0-59 |
| void SilverLining::LocalTime::SetMonth | ( | int | month | ) | [inline] |
Sets the calendar month to simulate.
| month | The month to simulate, ranging from 1 (January) to 12 (December). |
| void SilverLining::LocalTime::SetObservingDaylightSavingsTime | ( | bool | inDST | ) | [inline] |
Sets if Daylight Savings Time is currently observed in the simulation.
Not required if using SetFromEpochSeconds(), but must be set otherwise.
| void SilverLining::LocalTime::SetSeconds | ( | double | seconds | ) | [inline] |
Sets the second of the minute to simulate.
| seconds | Seconds from 0-59. |
| void SilverLining::LocalTime::SetTimeZone | ( | double | zone | ) | [inline] |
Specifies the time zone being simulated.
This is an hour offset from GMT, use the TimeZones enumerated type as a convenient way to specify the hour offset for a known time zone. Be sure that this time zone is consistent with the Location you specify.
| zone | Hour offset from GMT, ignoring daylight savings time. ie, PST is -8. Use the TimeZones enumeration to obtain the hour offset for specific time zones. |
| void SilverLining::LocalTime::SetYear | ( | int | year | ) | [inline] |
Set the calendar year to simulate.
SilverLining can only handle Gregorian calendar years, which means that years before 1582 will not be accurately simulated.
1.6.2