A QDOS Time object is a representation of a time. A Time can either be treated as a date,
i.e. a specific time instant in some date system (eg:
``14-Jun-1999 12:30:51.123'') or as a period of time (eg: 4503.237 seconds).
Knowledge of the internal represention of date/time used by Time is usually not required.
The representation is the class Time::TRep, which is a double representing seconds (for time periods)
or seconds from J2000.0 (Jan 1, 12:00GMT).
You may apply basic mathematical operations (+,-,*,/) to time objects, e.g.
t1 += Seconds(90.0)
to add 90 seconds to t1. Also, you may use following QDOS functions:
Time Time( string& iso_time )
e.g. Time t1("02-Jan-2000 12:00:00.000")
to create a time object from an ISO string.
Time Time(int year, int month, int day, double hour=0.0,
double min=0.0, double sec=0.0 )
e.g. Time t1(2000,1,2,12.0)
to create from a month/date representation. This is equivalent
to Time t1(2000,1,2,12.0, 0.0, 0.0)
, but the default argument values ensure that
it is only necessary to specify down to the last non-zero argument value.
Days(int days),Hours(int hours),Minutes(int minutes),
Seconds(double seconds), mSeconds(int msecs)
t1 = t0(2000,1,1) + Days(1) + Hours(12) + Seconds(30.005)
t1 += Minutes(1) + Seconds(1.5)
is equivalent to
t1 += Seconds(61.5)
Time& set_ydoy(int year, int doy, double hour=0.0, double min=0.0,
double sec=0.0 )
,
t1.set_ydoy(2000,2,12)
to set t1 from year and day-of-year.
Time& set_ymd(int year, int month, int day, double hour=0.0,
double min=0.0, double sec=0.0 )
t1.set_ymd(2000,1,2,12)
to set t1 from year, month and day.
double day_of_year(void )
, e.g. doy = t1.day_of_year()
will return 1.5.
void display()
, e.g. t1.display()
will display current value of t1 on stdout.
string iso_srep(void )
, e.g. tstr = t1.iso_rep()
will return ISO string.
void split_dhms(int& d, int& h, int& m, double& s )
,
t1.split_dhms(d,h,m,s)
will return a duration as days, hours, minutes, seconds.
void split_ydoy(int& year, int& doy, int& hour, int& min,
double& sec )
t1.split_ydoy(year,doy,hour)
will return year, doy, hour etc.
void split_ymd(int& year, int& month, int& day, int& hour,
int& min, double& sec )
,
t1.split_ymd(year,month,day,hour)
will return year, month, day, hour of t1.