casacore
|
#include <Time.h>
Public Member Functions | |
Time () | |
the default constructor returns an object with the present date and time More... | |
Time (double jdn) | |
Construct time with Julian day number. More... | |
Time (uInt year, uInt month, uInt day, uInt hour=0, uInt min=0, double sec=0.0) | |
Construct Time with Gregorian calendar. More... | |
Time (const Time &time) | |
Copy constructor. More... | |
double | julianDay () const |
return the Julian day (unit day) More... | |
double | modifiedJulianDay () const |
return the modified Julian day (unit day) More... | |
Time & | operator= (const Time &time) |
initialise the julian day data with Time class More... | |
double | operator- (const Time &begin) |
Time | operator+ (const double plus) |
Bool | operator== (const Time &other) const |
Bool | operator!= (const Time &other) const |
Bool | operator> (const Time &other) const |
Bool | operator< (const Time &other) const |
String | toString (const Bool iso=False) const |
if iso is True, then use ISO 8601 format otherwise, produce the string of the form Tue Mar 22 16:40:24 1994 with GMT time More... | |
const String | ISODate () const |
returns a String in ISO 8601 format YYYY-MM-DDTHH:MM:SS in GMT note: for dates beyond year 9999, use more digits for year More... | |
void | now () |
reset date to the present instant More... | |
void | setDate (uInt year, uInt month, uInt day, uInt hour=0, uInt min=0, double sec=0.0) |
double | age () |
number of seconds which have elapsed since Time object was created or reset More... | |
uInt | seconds () |
Return the seconds, minutes or hour part of the time. More... | |
double | dseconds () |
uInt | minutes () |
uInt | hours () |
uInt | dayOfMonth () |
uInt | month () |
uInt | year () |
uInt | dayOfWeek () |
uInt | dayOfYear () |
Static Public Member Functions | |
static uInt | howManyDaysInMonth () |
static uInt | howManyDaysInMonth (uInt month, uInt year) |
static Bool | isLeapYear () |
static Bool | isLeapYear (uInt year) |
static Int | timeZoneSeconds () |
Returns the difference, in seconds, between UTC and local time. More... | |
static Double | timeZoneDays () |
Same as timeZoneSeconds(), but returns fractional days rather than seconds. More... | |
static String | timeZoneName () |
Returns a string, e.g. More... | |
Protected Attributes | |
uInt | mJulianDay |
Modified Julian day number 40587 modified Julian day number = 00:00:00 January 1, 1970, GMT. More... | |
double | mJulianDayfrac |
the fraction of the day More... | |
Friends | |
ostream & | operator<< (ostream &out, const Time &other) |
write the current time, GMT, in format Tue Mar 22 16:40:24 1994 More... | |
istream & | operator>> (istream &, Time &) |
read in date, which must be in the following format month/day/year,hour:min:sec where month,day,year,hour,min and sec are uInt. More... | |
date and time enquiry functions, with some operations.
Public interface
This class might be better named a Date object, especially given that more accurate Time classes are going to be required.
This class provides convenient date objects for the programmer. Once constructed, they may be compared, read and written, and queried for a wide variety of re-expressions. In a typical (?) use you might create a Time object, and then query it to find out the current month, day of the week, and whether it is a leap year. You can also find out the number of seconds which have elapsed since a specific Time.
Caution: This class should not be used for very high precision work; The time from epoch (1970;0) in seconds is interconverted between computer "double" values, and some loss of accuracy might result;
casacore::Time::Time | ( | ) |
the default constructor returns an object with the present date and time
casacore::Time::Time | ( | double | jdn | ) |
Construct time with Julian day number.
casacore::Time::Time | ( | uInt | year, |
uInt | month, | ||
uInt | day, | ||
uInt | hour = 0 , |
||
uInt | min = 0 , |
||
double | sec = 0.0 |
||
) |
Construct Time with Gregorian calendar.
casacore::Time::Time | ( | const Time & | time | ) |
Copy constructor.
double casacore::Time::age | ( | ) |
number of seconds which have elapsed since Time object was created or reset
uInt casacore::Time::dayOfMonth | ( | ) |
uInt casacore::Time::dayOfWeek | ( | ) |
uInt casacore::Time::dayOfYear | ( | ) |
double casacore::Time::dseconds | ( | ) |
uInt casacore::Time::hours | ( | ) |
|
static |
|
static |
|
inline |
returns a String in ISO 8601 format YYYY-MM-DDTHH:MM:SS in GMT note: for dates beyond year 9999, use more digits for year
Definition at line 135 of file Time.h.
References toString(), and casacore::True.
double casacore::Time::julianDay | ( | ) | const |
return the Julian day (unit day)
uInt casacore::Time::minutes | ( | ) |
double casacore::Time::modifiedJulianDay | ( | ) | const |
return the modified Julian day (unit day)
uInt casacore::Time::month | ( | ) |
void casacore::Time::now | ( | ) |
reset date to the present instant
Time casacore::Time::operator+ | ( | const double | plus | ) |
double casacore::Time::operator- | ( | const Time & | begin | ) |
uInt casacore::Time::seconds | ( | ) |
Return the seconds, minutes or hour part of the time.
void casacore::Time::setDate | ( | uInt | year, |
uInt | month, | ||
uInt | day, | ||
uInt | hour = 0 , |
||
uInt | min = 0 , |
||
double | sec = 0.0 |
||
) |
|
static |
Same as timeZoneSeconds(), but returns fractional days rather than seconds.
|
static |
Returns a string, e.g.
"EST" or "MDT", describing the current local time zone.
|
static |
Returns the difference, in seconds, between UTC and local time.
Negative values are west of GMT, positive are east.
if iso is True, then use ISO 8601 format otherwise, produce the string of the form Tue Mar 22 16:40:24 1994 with GMT time
Referenced by ISODate().
uInt casacore::Time::year | ( | ) |
|
friend |
|
friend |
read in date, which must be in the following format month/day/year,hour:min:sec where month,day,year,hour,min and sec are uInt.
|
protected |
|
protected |