69 static const tFlag YEAR;
70 static const tFlag MONTH;
71 static const tFlag WEEK;
72 static const tFlag DAY;
73 static const tFlag WEEK_DAY;
74 static const tFlag HOUR;
75 static const tFlag MINUTE;
76 static const tFlag SECUND;
77 static const tFlag MILLI_SECUNDS;
100 tTime mSecondsSince1900;
136 inline static SP::CORE_Time
New(){
143 SP::CORE_Time p=
New();
150 SP::CORE_Time p=
New();
151 if (time!=
null) p->setDate(*time);
156 inline static SP::CORE_Time
New(
const tTime& time){
157 SP::CORE_Time p=
New();
163 inline static SP::CORE_Time
New(
const SP::CORE_Time& time){
164 SP::CORE_Time p=
New();
165 p->setDate(time.get());
171 inline static SP::CORE_Time
New(
const int& year,
175 t->setDate(year,month,day,0,0,1,0);
184 tTime secs=time->getSecondsSince1900();
191 tTime secs=time->getSecondsSince1900()*1000+time->getMilliSeconds();
212 if ((mMonth==0) && (mWeek>25)) year--;
213 if ((mMonth==11) && (mWeek<25)) year++;
245 t->setDate(mYear,mMonth+1,29,0,0,0,0);
246 if (t->getMonth()==2)
return 29;
283 void setToWeekDay(
const int& year,
const int& week,
const int& day);
317 return mMilliSeconds;
322 return mSecondsSince1900;
335 void setDate(
const int& year,
const int& month,
const int& day,
336 const int& hour,
const int& minutes,
const int& seconds,
const int& ms);
342 inline void setDate(
const int& year,
const int& month,
const int& day,
343 const int& hour,
const int& minutes,
const int& seconds) {
344 setDate(year,month,day,hour,minutes,seconds,0);
378 if (time==
null)
return;
407 void setTime(
const int& hour,
const int& minutes,
const int& seconds);
418 const SP::CORE_Time& time2);
425 return sub(time2.get());
430 if (time2!=
null)
return sub(*time2);
440 const SP::CORE_Time& time2);
447 return sub(time2.get());
452 if (time2!=
null)
return sub(*time2);
459 setDate(mSecondsSince1900+24*3600);
464 setDate(mSecondsSince1900-24*3600);
469 setDate(mSecondsSince1900-nDays*24*3600);
480 setDate(y,mo+1,mDay,mHours,mMinutes,mSeconds,0);
491 setDate(y,mo+1,mDay,mHours,mMinutes,mSeconds,0);
496 setDate(mSecondsSince1900+7*24*3600);
501 setDate(mSecondsSince1900-7*24*3600);
513 setDate(mSecondsSince1900-23*3600);
519 if (t==
null)
return false;
535 if (t==
null)
return true;
563 return (mSecondsSince1900==t->getSecondsSince1900());
573 return (mSecondsSince1900>t->getSecondsSince1900());
583 return (mSecondsSince1900>=t->getSecondsSince1900());
603 return getDuration(duration,days,hours,minutes,seconds,ms);
625 static char *_fmt(
const struct tm *t,
char *pt,
const char *ptlim);
626 static char *_conv(
const int n,
const char *format,
char *pt,
const char *ptlim);
627 static char *_add(
const char *str,
char *pt,
const char *ptlim);
629 static int getWeek(
const struct tm *t);
633 #endif // end of ifndef
tBoolean isBeforeOrEqual(const SP::CORE_Time &t) const
return true if this <= t
Definition: CORE_Time.h:577
static const tTime MAX_YEAR
MAX number of years.
Definition: CORE_Time.h:67
tTime getSecondsSince1900() const
return the number of seconds since 1900
Definition: CORE_Time.h:321
static SP::CORE_Time New()
creates a time object
Definition: CORE_Time.h:136
void setDate(const tTime &seconds)
set the date from 1900 in seconds
Definition: CORE_Time.cpp:202
int getYear() const
return the year
Definition: CORE_Time.h:220
void setToNextWeek()
set to next week
Definition: CORE_Time.h:495
void setToPreviousWeek()
set to previoust week
Definition: CORE_Time.h:500
void setDate(const CORE_Time *time)
set the date from a string year-month-day
Definition: CORE_Time.h:377
this class describes a time class
Definition: CORE_Time.h:60
tBoolean isAfter(const SP::CORE_Time &t) const
return true if this > t
Definition: CORE_Time.h:572
static tTime getDateInMilliSeconds()
return the time in 1/60 seconds
Definition: CORE_Time.h:189
int getMinutes() const
return the minutes of the time
Definition: CORE_Time.h:297
void setToPreviousMonth()
set to previous month
Definition: CORE_Time.h:484
long int getCPUTime() const
return the CPU time in 1/60 seconds
Definition: CORE_Time.h:202
tString getWeekIntervalString()
get the week interval monday –> Sunday of the current time
Definition: CORE_Time.h:269
#define tRelativeInteger
Definition: types.h:33
static tString getDuration(const long int &duration, int &days, int &hours, int &minutes, int &seconds, int &ms)
get duration
Definition: CORE_Time.cpp:574
void setToWeekDay(const int &year, const int &week, const int &day)
set the date to the week day week must be in [1..53] day in [0,6] 0:MONDAY....6:SUNDAY the first day ...
Definition: CORE_Time.cpp:451
#define tBoolean
Definition: types.h:35
tBoolean isAfterOrEqual(const CORE_Time &t) const
return true if this >= t
Definition: CORE_Time.h:557
tBoolean isBefore(const CORE_Time *t) const
return true if this < t
Definition: CORE_Time.h:534
static SP::CORE_Time New(const SP::CORE_Time &time)
creates a time object
Definition: CORE_Time.h:163
#define tTime
Definition: types.h:41
#define null
Definition: types.h:13
tBoolean isEqual(const CORE_Time *t) const
return true if the 2 dates are equals
Definition: CORE_Time.h:518
static const tString JOURS[]
days names in french
Definition: CORE_Time.h:108
static SP::CORE_Time New(const tTime &time)
creates a time object
Definition: CORE_Time.h:156
int getDaysNumberInMonth() const
return the number of days in month
Definition: CORE_Time.h:232
int getSeconds() const
return the seconds of the time
Definition: CORE_Time.h:304
void setDate(const CORE_Time &time)
set the date from a string year-month-day
Definition: CORE_Time.h:361
static long int getTime()
return the time in 1/60 seconds
Definition: CORE_Time.h:197
tRelativeInteger subInMilliSeconds(const CORE_Time *time2) const
get the difference with time2 this -time2 in secunds
Definition: CORE_Time.h:451
CORE_Time()
create a general time object
Definition: CORE_Time.cpp:89
void setToLastDay(const int &year, const int &month)
set to last day of month
Definition: CORE_Time.h:505
tBoolean isAfter(const CORE_Time &t) const
return true if this > t
Definition: CORE_Time.h:540
void setToPreviousDays(const int &nDays)
set to days ago
Definition: CORE_Time.h:468
int getMilliSeconds() const
return the milliseconds seconds of the time
Definition: CORE_Time.h:316
tBoolean isAfter(const CORE_Time *t) const
return true if this > t
Definition: CORE_Time.h:545
void setToNextDay()
set to next day
Definition: CORE_Time.h:458
void setTime(const int &hour, const int &minutes, const int &seconds)
set the time
Definition: CORE_Time.cpp:216
void setHour(const tString &h)
set hour xxhyy
Definition: CORE_Time.cpp:485
static tRelativeInteger subTimesInMilliSeconds(const CORE_Time &time1, const CORE_Time &time2)
get the difference betwen two dates in milli-secund time1-time2
Definition: CORE_Time.cpp:244
void setToNextMonth()
set to next month
Definition: CORE_Time.h:473
static const tString MOIS[]
month names in french
Definition: CORE_Time.h:115
static tRelativeInteger subTimes(const CORE_Time &time1, const CORE_Time &time2)
get the difference betwen two dates in secund time1-time2
Definition: CORE_Time.cpp:241
static tTime getDateInSeconds()
return the time in 1/60 seconds
Definition: CORE_Time.h:182
int getWeekYear(int &year) const
get the week of the year
Definition: CORE_Time.h:210
void setDate(int year, int month, int day)
set the date year>=0 month in [1,12]
Definition: CORE_Time.h:350
tRelativeInteger sub(const CORE_Time *time2) const
get the difference with time2 this -time2 in secunds
Definition: CORE_Time.h:429
abstract base class for most classes.
Definition: CORE_Object.h:30
static const tString DAYS[]
days names in english
Definition: CORE_Time.h:105
static SP::CORE_Time New(const CORE_Time *time)
creates a time object
Definition: CORE_Time.h:149
int getWeekDay() const
return the day of the week 0:Sunday [0..6]
Definition: CORE_Time.h:290
#define tString
Definition: types.h:36
tRelativeInteger subInMilliSeconds(const CORE_Time &time2) const
get the difference with time2 this -time2 in secunds
Definition: CORE_Time.cpp:261
static tString getDuration(const long int &duration)
get duration
Definition: CORE_Time.h:596
tBoolean isBeforeOrEqual(const CORE_Time &t) const
return true if this <= t
Definition: CORE_Time.h:552
tBoolean isEqual(const CORE_Time &t) const
return true if the 2 dates are equals
Definition: CORE_Time.h:524
static SP::CORE_Time New(const CORE_Time &time)
creates a time object
Definition: CORE_Time.h:142
void setToPreviousDay()
set to previous day
Definition: CORE_Time.h:463
static SP::CORE_Time New(const int &year, const int &month, const int &day)
creates a time object year > 1900 month [1,12] day [1,31]
Definition: CORE_Time.h:171
void setToFirstWeekDay(const int &year, const int &week)
set the date to the first week day week must be in [1..53] the first day is a monday ...
Definition: CORE_Time.cpp:424
tBoolean isBefore(const SP::CORE_Time &t) const
return true if this < t
Definition: CORE_Time.h:567
void setDate(SP::CORE_Time time)
set the date from a string year-month-day
Definition: CORE_Time.h:372
tRelativeInteger sub(const SP::CORE_Time &time2) const
get the difference with time2 this -time2 in secunds
Definition: CORE_Time.h:424
virtual tString toString() const
return the time into a string
Definition: CORE_Time.cpp:320
virtual ~CORE_Time()
remove
Definition: CORE_Time.cpp:148
tRelativeInteger subInMilliSeconds(const SP::CORE_Time &time2) const
get the difference with time2 this -time2 in secunds
Definition: CORE_Time.h:446
int getMonth() const
return the month
Definition: CORE_Time.h:227
tBoolean isAfterOrEqual(const SP::CORE_Time &t) const
return true if this >= t
Definition: CORE_Time.h:582
int getDay() const
return the day
Definition: CORE_Time.h:260
int getHours() const
return the hours of the time
Definition: CORE_Time.h:311
tRelativeInteger sub(const CORE_Time &time2) const
get the difference with time2 this -time2 in secunds
Definition: CORE_Time.cpp:253
static const tString MONTHS[]
month names in english
Definition: CORE_Time.h:112
tBoolean isBefore(const CORE_Time &t) const
return true if this < t
Definition: CORE_Time.h:529
void setDate(const int &year, const int &month, const int &day, const int &hour, const int &minutes, const int &seconds)
set the date year>=0 month in [1,12] day in [1,31]
Definition: CORE_Time.h:342
tBoolean isEqual(const SP::CORE_Time &t) const
return true if the 2 dates are equals
Definition: CORE_Time.h:562
class Free introduced for deleting a smart pointer
Definition: CORE_Object.h:106
#define tFlag
Definition: types.h:14