4 #include "Kernel_global.h"
18 class KERNELSHARED_EXPORT
Time {
23 enum TimePart{tpYEAR, tpMONTH, tpDAYOFMONTH, tpJULIANDAY, tpDAYOFTHEWEEK, tpDAYOFTHEYEAR, tpWEEKNUMBER, tpHOUR, tpMINUTE, tpSECOND, tpDATE, tpDAYTIME};
38 Time(
int year,
int month,
int day,
int hour,
int minute,
double seconds=0);
48 Time(
int hour,
int minute,
double seconds=0);
58 Time(
int year,
int month=1,
int day=1);
64 Time(
const time_t time);
73 Time(
const QString& isostring);
74 Time(
const char * isostring);
81 Time(
double jd, IlwisTypes m =itDATETIME);
89 Time(
const QDateTime &time);
90 Time(
const QDate& date);
91 Time(
const QTime& tm);
102 operator double()
const;
107 operator QDateTime()
const;
115 Time& operator=(
double t);
121 time_t toTime_t()
const;
129 bool isLeapYear(
int year = iUNDEF)
const;
149 virtual double get(TimePart part)
const;
182 bool operator <(
const Time& time)
const;
193 bool operator >(
const Time& time)
const;
204 bool operator ==(
const Time& time)
const;
215 bool operator !=(
const Time& time)
const;
227 void setValue(
const QString& isostring);
236 void setYear(
int year);
245 void setMonth(
int Mnt);
263 void setHour(
int hr);
272 void setMinute(
int min);
281 void setSecond(
double sec);
295 virtual QString toString(
bool local=
false, IlwisTypes tp=itUNKNOWN)
const;
303 virtual bool isValid()
const;
313 IlwisTypes valueType()
const;
316 void valueType(IlwisTypes tp);
319 void checkDate(
int year,
int month,
int day);
320 void checkTime(
int hour,
int minute,
double seconds);
322 double gregorianToJulian(
int year,
int month,
int day,
int hour,
int minutes,
double seconds)
const;
323 void julianToGregorian(
int& year,
int& month,
int& day,
int& hour,
int& minutes,
double& seconds)
const;
324 int julianyearday(
int year,
int month,
int day)
const;
325 int tolong(
double val)
const;
326 void parseOrdinalDate(
int ordinal,
int year,
int& month,
int& day);
327 void parseYearPart(
const QString& yearpart,
int& year,
int& month,
int& day) ;
328 void parseDayPart(
const QString& dayPart,
int& hours,
int& minutes,
double& seconds);
329 void parseIsoString(
const QString& isostring,
int& year,
int& month,
int& day,
int& hours,
int& minutes,
double& seconds);
333 IlwisTypes _valuetype;
338 Duration(
const QString& step=
"",IlwisTypes tp=itTIME);
339 Duration(
double r,IlwisTypes tp=itTIME);
340 QString toString(
bool local, IlwisTypes tp=itTIME)
const;
341 bool isValid()
const;
352 Time begin()
const {
return Time(min());}
353 Time end()
const {
return Time(max());}
354 void begin(
const Time& t) ;
355 void end(
const Time& t);
356 Duration getStep()
const {
return _step;}
357 QString toString(
bool local, IlwisTypes)
const;
358 bool contains(
const QString& value,
bool inclusive =
true)
const;
359 bool contains(
const Time& value,
bool inclusive =
true)
const;
360 bool contains(
const QVariant& value,
bool inclusive =
true)
const;
361 QVariant impliedValue(
const QVariant& v)
const;
363 Range *clone()
const ;
364 bool isValid()
const;
370 #define tUNDEF Time()
375 Q_DECLARE_METATYPE(Ilwis::Duration)
376 Q_DECLARE_METATYPE(Ilwis::TimeInterval)