Документ взят из кэша поисковой машины. Адрес оригинального документа : http://www.atnf.csiro.au/computing/software/casacore/casacore-1.2.0/doc/html/classcasa_1_1Time.html
Дата изменения: Unknown
Дата индексирования: Mon Feb 14 19:59:01 2011
Кодировка:

Поисковые слова: rho ophiuchi
casacore: casa::Time Class Reference
Public Member Functions | Static Public Member Functions | Protected Attributes | Friends

casa::Time Class Reference
[OS_module]

date and time enquiry functions, with some operations. More...

#include <Time.h>

List of all members.

Public Member Functions

 Time ()
 the default constructor returns an object with the present date and time
 Time (double jdn)
 Construct time with Julian day number.
 Time (uInt year, uInt month, uInt day, uInt hour=0, uInt min=0, double sec=0.0)
 Construct Time with Gregorian calendar.
 Time (const Time &time)
 Copy constructor.
double julianDay () const
 return the Julian day
double modifiedJulianDay () const
 return the modified Julian day
Timeoperator= (const Time &time)
 initialise the julian day data with Time class
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
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
void now ()
 reset date to the present instant
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
uInt seconds ()
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.
static Double timeZoneDays ()
 Same as timeZoneSeconds(), but returns fractional days rather than seconds.
static String timeZoneName ()
 Returns a string, e.g.

Protected Attributes

uInt mJulianDay
 Modified Julian day number 40587 modified Julian day number = 00:00:00 January 1, 1970, GMT.
double mJulianDayfrac
 the fraction of the day

Friends

ostream & operator<< (ostream &out, const Time &other)
 write the current time, GMT, in format Tue Mar 22 16:40:24 1994
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.

Detailed Description

date and time enquiry functions, with some operations.

Intended use:

Public interface

Review Status

Reviewed By:
Paul Shannon
Date Reviewed:
1995/03/01
Test programs:
tTime

This class might be better named a Date object, especially given that more accurate Time classes are going to be required.

Prerequisite

Synopsis

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;

Example

     Time startTime;
     Time moonLanding (1969,7,14);
     cout << "date and time of moon landing: " << moonLanding << endl;
     cout << "day of week: " << moonLanding.dayOfWeek () << endl;
     cout << "day of year: " << moonLanding.dayOfYear () << endl;
     cout << "seconds since moon landing: " << moonLanding.age () << endl;
     cout << "weeks since moon landing: " <<
        moonLanding.age () / (60 * 60 * 24 * 7) << endl;
     cout << "seconds elapsed since start: " << startTime.age () << endl;

To Do

Definition at line 88 of file Time.h.


Constructor & Destructor Documentation

casa::Time::Time (  ) 

the default constructor returns an object with the present date and time

casa::Time::Time ( double  jdn  ) 

Construct time with Julian day number.

casa::Time::Time ( uInt  year,
uInt  month,
uInt  day,
uInt  hour = 0,
uInt  min = 0,
double  sec = 0.0 
)

Construct Time with Gregorian calendar.

  • seconds after the minute [0,59.999] (include milliseconds)
  • minutes after the hour [0,59]
  • hours after midnight [0,23]
  • day of the month [1,31]
  • month of the year [1,12]
  • year. Beware, because '94' refers to the early Christian era, not the 20th century.
casa::Time::Time ( const Time time  ) 

Copy constructor.


Member Function Documentation

double casa::Time::age (  ) 

number of seconds which have elapsed since Time object was created or reset

uInt casa::Time::dayOfMonth (  ) 
uInt casa::Time::dayOfWeek (  ) 
uInt casa::Time::dayOfYear (  ) 
uInt casa::Time::hours (  ) 
static uInt casa::Time::howManyDaysInMonth (  )  [static]
static uInt casa::Time::howManyDaysInMonth ( uInt  month,
uInt  year 
) [static]
static Bool casa::Time::isLeapYear (  )  [static]
static Bool casa::Time::isLeapYear ( uInt  year  )  [static]
const String casa::Time::ISODate (  )  const [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 casa::True.

double casa::Time::julianDay (  )  const

return the Julian day

uInt casa::Time::minutes (  ) 
double casa::Time::modifiedJulianDay (  )  const

return the modified Julian day

uInt casa::Time::month (  ) 
void casa::Time::now (  ) 

reset date to the present instant

Bool casa::Time::operator!= ( const Time other  )  const
Time casa::Time::operator+ ( const double  plus  ) 
double casa::Time::operator- ( const Time begin  ) 
Bool casa::Time::operator< ( const Time other  )  const
Time& casa::Time::operator= ( const Time time  ) 

initialise the julian day data with Time class

Bool casa::Time::operator== ( const Time other  )  const
Bool casa::Time::operator> ( const Time other  )  const
uInt casa::Time::seconds (  ) 
void casa::Time::setDate ( uInt  year,
uInt  month,
uInt  day,
uInt  hour = 0,
uInt  min = 0,
double  sec = 0.0 
)
static Double casa::Time::timeZoneDays (  )  [static]

Same as timeZoneSeconds(), but returns fractional days rather than seconds.

static String casa::Time::timeZoneName (  )  [static]

Returns a string, e.g.

"EST" or "MDT", describing the current local time zone.

static Int casa::Time::timeZoneSeconds (  )  [static]

Returns the difference, in seconds, between UTC and local time.

Negative values are west of GMT, positive are east.

String casa::Time::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

Referenced by ISODate().

uInt casa::Time::year (  ) 

Friends And Related Function Documentation

ostream& operator<< ( ostream &  out,
const Time other 
) [friend]

write the current time, GMT, in format Tue Mar 22 16:40:24 1994

Definition at line 140 of file Time.h.

istream& operator>> ( istream &  ,
Time  
) [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.


Member Data Documentation

Modified Julian day number 40587 modified Julian day number = 00:00:00 January 1, 1970, GMT.

Definition at line 198 of file Time.h.

double casa::Time::mJulianDayfrac [protected]

the fraction of the day

Definition at line 200 of file Time.h.


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines