C++ main module for emicrom Package  1.0
CORE_Time.h
Go to the documentation of this file.
1 
2 
3 #ifndef CORE_TIME_H
4 #define CORE_TIME_H
5 
6 #include "CORE_Object.h"
7 #include "CORE_Pointers.h"
8 #include "CORE_ListPointers.h"
9 #include "types.h"
10 #include <ctime>
11 #include <chrono>
12 
13 
14 
63 
64 class CORE_Time : public CORE_Object {
66 
67  // attributes
68 public:
71  static const tULLInt MAX_YEAR;
72 
73  static const tFlag SYSTEM_CLOCK_TIME=0;
74  static const tFlag HR_CLOCK_TIME=1;
75  static const tFlag CLOCK_TIME=2;
76 
77 private:
78  static tFlag TIME_TYPE;
79 
80  static const tFlag YEAR;
81  static const tFlag MONTH;
82  static const tFlag WEEK;
83  static const tFlag DAY;
84  static const tFlag WEEK_DAY;
85  static const tFlag HOUR;
86  static const tFlag MINUTE;
87  static const tFlag SECUND;
88  static const tFlag MILLI_SECUNDS;
89 
90  // year of the date [1900,...[
92  // month of the date [0,11]
94  // week of the day in year [1,53]
96  // week of the day in week [0,6] 0:Sunday
98  // day number [1,31]
100  // hours [0,23]
102  // minutes [0,59]
104  // seconds [0,59]
106  // milli seconds [0,999]
108  // cpu time
110  // secunds since 1900
112 
113  //chrono
114  std::chrono::high_resolution_clock::time_point mStartHRClock;
115  std::chrono::system_clock::time_point mStartSystemClock;
117 
118 
122 
123 public:
126  static const tString DAYS[];
129  static const tString JOURS[];
130  // month names
133  static const tString MONTHS[];
136  static const tString MOIS[];
137 
138 
139  // asociations
140  // methods
141 
142 public:
143  // builders
146  CORE_Time();
147 
148 
151  virtual ~CORE_Time();
152 
153 
154 public:
158  inline static SP::CORE_Time New(){
159  SP::CORE_Time p(new CORE_Time(),CORE_Time::Delete());
160  return p;
161  };
166  inline static SP::CORE_Time New(const CORE_Time& time){
167  SP::CORE_Time p=New();
168  p->setDate(time);
169  return p;
170  };
175  inline static SP::CORE_Time New(const CORE_Time* time){
176  SP::CORE_Time p=New();
177  if (time!=null) p->setDate(*time);
178  return p;
179  };
183  inline static SP::CORE_Time New(const tTime& time){
184  SP::CORE_Time p=New();
185  p->setDate(time);
186  return p;
187  };
191  inline static SP::CORE_Time New(const SP::CORE_Time& time){
192  SP::CORE_Time p=New();
193  p->setDate(time.get());
194  return p;
195  };
196 
203  inline static SP::CORE_Time New(const tUInteger& year,
204  const tUInteger& month,
205  const tUInteger& day){
206  SP::CORE_Time t(new CORE_Time(),CORE_Time::Delete());
207  t->setDate(year,month,day,0,0,1,0);
208  return t;
209  };
210 
211 
216  SP::CORE_Time time=CORE_Time::New();
217  tTime secs=time->getSecondsSince1900();
218  return secs;
219  }
224  SP::CORE_Time time=CORE_Time::New();
225  tTime secs=time->getSecondsSince1900()*1000+time->getMilliSeconds();
226  return secs;
227  }
228 
232  static tULLInt getTime(){
233  return getDateInMilliSeconds();
234  }
238  inline tULLInt getCPUTime() const{
239  return mCPUTime;
240  };
241 
242 
248  year=mYear;
249  if ((mMonth==0) && (mWeek>25)) year--;
250  if ((mMonth==11) && (mWeek<25)) year++;
251  return mWeek;
252  };
253 
258  inline const tUInteger& getYear() const{
259  return mYear;
260  };
265  inline tUInteger getMonth() const{
266  return mMonth+1;
267  };
273  SP::CORE_Time t;
274  switch(mMonth) {
275  case 0:
276  case 2:
277  case 4:
278  case 6:
279  case 7:
280  case 9:
281  case 11:
282  return 31;
283  case 1:
284  t=CORE_Time::New();
285  t->setDate(mYear,mMonth+1,29,0,0,0,0);
286  if (t->getMonth()==2) return 29;
287  return 28;
288  case 3:
289  case 5:
290  case 8:
291  case 10:
292  return 30;
293  }
294  return 30;
295  }
300  inline tUInteger getDay() const{
301  return mDay;
302  };
308  static tString getWeekIntervalString(const tUInteger& year,const tUInteger& week);
309 
314  return getWeekIntervalString(mYear,mWeek);
315  }
321  void setToFirstWeekDay(const tUInteger& year,const tUInteger& week);
322 
329  void setToWeekDay(const tUInteger& year,const tUInteger& week,const tUInteger& day);
330 
331 
336  inline const tUInteger& getWeekDay() const{
337  return mWeekDay;
338  };
343  inline const tUInteger& getMinutes() const{
344  return mMinutes;
345  };
350  inline const tUInteger& getSeconds() const{
351  return mSeconds;
352  };
357  inline const tUInteger& getHours() const{
358  return mHours;
359  };
363  inline const tULLInt& getMilliSeconds() const{
364  return mMilliSeconds;
365  };
369  inline const tTime& getSecondsSince1900() const {
370  return mSecondsSince1900;
371  };
372 
376  void setDate(const tTime& seconds);
377 
378 
388  void setDate(const tUInteger& year,const tUInteger& month,const tUInteger& day,
389  const tUInteger& hour,const tUInteger& minutes,const tUInteger& seconds,const tUInteger& ms);
398  inline void setDate(const tUInteger& year,const tUInteger& month,const tUInteger& day,
399  const tUInteger& hour,const tUInteger& minutes,const tUInteger& seconds) {
400  setDate(year,month,day,hour,minutes,seconds,0);
401  };
407  inline void setDate(tUInteger year,
408  tUInteger month,
409  tUInteger day){
410  setDate(year,month,day,0,0,0);
411  };
412 
416  void setDate(const tString& date);
420  inline void setDate(const CORE_Time& time) {
421  setDate(time.getYear(),
422  time.getMonth(),
423  time.getDay(),
424  time.getHours(),
425  time.getMinutes(),
426  time.getSeconds());
427 
428  };
432  inline void setDate(SP::CORE_Time time) {
433  setDate(time.get());
434  };
438  inline void setDate(const CORE_Time* time) {
439  if (time==null) return;
440  setDate(time->getYear(),
441  time->getMonth(),
442  time->getDay(),
443  time->getHours(),
444  time->getMinutes(),
445  time->getSeconds());
446 
447  };
448 
460  void setDate(const tString& date,const tString& format);
461 
465  void setHour(const tString& h);
466 
472  void setTime(const tUInteger& hour,const tUInteger& minutes,const tUInteger& seconds);
475  void setTime(const tString& date);
476 
482  static tLLInt subTimes(const CORE_Time& time1, const CORE_Time& time2);
488  static tLLInt subTimes(const SP::CORE_Time& time1,
489  const SP::CORE_Time& time2);
494  tLLInt sub(const CORE_Time& time) const;
499  tLLInt sub(const SP::CORE_Time& time) const {
500  return sub(time.get());
501  }
502 
507  tLLInt sub(const CORE_Time* time) const {
508  if (time!=null) return sub(*time);
509  return getSecondsSince1900();
510  }
511 
516  static tLLInt subTimesInMilliSeconds(const CORE_Time& time1, const CORE_Time& time2);
517 
522  static tLLInt subTimesInMilliSeconds(const SP::CORE_Time& time1,
523  const SP::CORE_Time& time2);
524 
530  tLLInt subInMilliSeconds(const CORE_Time& time) const;
531 
536  tLLInt subInMilliSeconds(const SP::CORE_Time& time) const {
537  return sub(time.get());
538  }
543  tLLInt subInMilliSeconds(const CORE_Time* time) const {
544  if (time!=null) return sub(*time);
545  return getSecondsSince1900()*1000+mMilliSeconds;
546  }
547 
550  inline void setToNextDay() {
551  setDate(mSecondsSince1900+24*3600);
552  };
555  inline void setToPreviousDay() {
556  setDate(mSecondsSince1900-24*3600);
557  };
561  inline void setToPreviousDays(const tUInteger& nDays) {
562  setDate(mSecondsSince1900-nDays*24*3600);
563  };
566  inline void setToNextMonth() {
567  tUInteger mo=mMonth+1;
568  tUInteger y=mYear;
569  if (mo==12) {
570  mo=0;
571  y++;
572  }
573  setDate(y,mo+1,mDay,mHours,mMinutes,mSeconds,0);
574  };
577  inline void setToPreviousMonth() {
578  tInteger mo=mMonth-1;
579  tUInteger y=mYear;
580  if (mo==-1) {
581  mo=11;
582  y--;
583  }
584  setDate(y,mo+1,mDay,mHours,mMinutes,mSeconds,0);
585  };
588  inline void setToNextWeek() {
589  setDate(mSecondsSince1900+7*24*3600);
590  };
593  inline void setToPreviousWeek() {
594  setDate(mSecondsSince1900-7*24*3600);
595  };
600  inline void setToLastDay(const tUInteger& year,const tUInteger& month) {
601  tUInteger mo=month+1;
602  tUInteger ye=year;
603  if (mo==13) {
604  mo=1;
605  ye++;
606  }
607  setDate(ye,mo,1,0,0,0,0);
608  setDate(mSecondsSince1900-23*3600);
609  };
610 
614  inline void setTimeType(const tFlag & f) {
615  TIME_TYPE=f;
616  }
617 
618  /* \brief get the clock time
619  * @return the time
620  */
621  inline static tULLInt getClockTime() {
622  return std::clock();
623  }
624  /* \brief get the clock time duration
625  * @param[in] start_time : start time in clock
626  * @return the duration in milliseconds
627  */
628  inline static tULLInt getClockDuration(const tULLInt& startTime) {
629  return (1000*(std::clock()-startTime))/CLOCKS_PER_SEC;
630  }
631 
632 
633  /* \brief start the chrono time
634  */
635  inline void startChronoTime() {
636  startChronoTime(TIME_TYPE);
637  }
638 
639  /* \brief start the chrono time
640  * @param[in] f : type of the time in {CHRONO_TIME, CLOCK_TIME }
641  */
642  inline void startChronoTime(const tFlag& f) {
643 
644  switch(f) {
645  case HR_CLOCK_TIME:
646  mStartHRClock=std::chrono::high_resolution_clock::now();
647  mIsHRClockChronoStarting=true;
648  break;
649  case SYSTEM_CLOCK_TIME:
650  mStartSystemClock=std::chrono::system_clock::now();
651  mIsSystemClockChronoStarting=true;
652  break;
653  case CLOCK_TIME:
654  default:
655  mStartClock=std::clock();
656  mIsClockChronoStarting=true;
657  break;
658  }
659  }
664  return stopChronoTime(TIME_TYPE);
665  }
666 
667  /* \brief start the chrono time
668  * @param[in] f : type of the time in {CHRONO_TIME, CLOCK_TIME }
669  * @return the duration of the chrono in milliseconds
670  */
671  inline tULLInt stopChronoTime(const tFlag& f) {
672 
673  tULLInt nMilliSeconds=0;
674  switch(f) {
675  case HR_CLOCK_TIME:
676  if (!mIsHRClockChronoStarting) throw CORE_Exception("common/core/",
677  "CORE_Time::stopChronoTime()",
678  "can not stop a HR clock chrono without starting it");
679 
680  nMilliSeconds=(tULLInt) std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::high_resolution_clock::now()-mStartHRClock).count();
681  mIsHRClockChronoStarting=false;
682  break;
683  case SYSTEM_CLOCK_TIME:
684  if (!mIsSystemClockChronoStarting) throw CORE_Exception("common/core/",
685  "CORE_Time::stopChronoTime()",
686  "can not stop a system clock chrono without starting it");
687  nMilliSeconds=(tULLInt) std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::system_clock::now()-mStartSystemClock).count();
688  mIsSystemClockChronoStarting=false;
689  break;
690  case CLOCK_TIME:
691  default:
692  if (!mIsClockChronoStarting) throw CORE_Exception("common/core/",
693  "CORE_Time::stopChronoTime()",
694  "can not stop a clock chrono without starting it");
695  nMilliSeconds=getClockDuration(mStartClock);
696  mIsClockChronoStarting=false;
697  break;
698  }
699  return nMilliSeconds;
700  }
701 
702 
703 
709  return continueChronoTime(TIME_TYPE);
710 
711  }
712  /* \brief start the chrono time
713  * @param[in] f : type of the time in {CHRONO_TIME, CLOCK_TIME }
714  * @return the duration of the chrono in seconds
715  */
716  inline tULLInt continueChronoTime(const tFlag& f) {
717  tULLInt dt=stopChronoTime(f);
718  startChronoTime(f);
719  return dt;
720  }
721 
722 
723 
724 
728  inline tBoolean isEqual(const CORE_Time* t) const {
729  if (t==null) return false;
730  return (mSecondsSince1900==t->getSecondsSince1900());
731  };
736  inline tBoolean isEqual(const CORE_Time& t) const {
737  return (mSecondsSince1900==t.getSecondsSince1900());
738  };
743  inline tBoolean isBefore(const CORE_Time& t) const {
744  return (mSecondsSince1900<t.getSecondsSince1900());
745  };
750  inline tBoolean isBefore(const CORE_Time* t) const {
751  if (t==null) return true;
752  return (mSecondsSince1900<t->getSecondsSince1900());
753  };
758  inline tBoolean isAfter(const CORE_Time& t) const {
759  return (mSecondsSince1900>t.getSecondsSince1900());
760  };
765  inline tBoolean isAfter(const CORE_Time* t) const {
766  if (t!=null)
767  return (mSecondsSince1900>t->getSecondsSince1900());
768  return false;
769  };
774  inline tBoolean isBeforeOrEqual(const CORE_Time& t) const {
775  return (mSecondsSince1900<=t.getSecondsSince1900());
776  };
781  inline tBoolean isAfterOrEqual(const CORE_Time& t) const {
782  return (mSecondsSince1900>=t.getSecondsSince1900());
783  };
788  inline tBoolean isEqual(const SP::CORE_Time& t) const {
789  return (mSecondsSince1900==t->getSecondsSince1900());
790  };
795  inline tBoolean isBefore(const SP::CORE_Time& t) const {
796  return (mSecondsSince1900<t->getSecondsSince1900());
797  };
802  inline tBoolean isAfter(const SP::CORE_Time& t) const {
803  return (mSecondsSince1900>t->getSecondsSince1900());
804  };
809  inline tBoolean isBeforeOrEqual(const SP::CORE_Time& t) const {
810  return (mSecondsSince1900<=t->getSecondsSince1900());
811  };
816  inline tBoolean isAfterOrEqual(const SP::CORE_Time& t) const {
817  return (mSecondsSince1900>=t->getSecondsSince1900());
818  };
819 
831  static tString getDuration(const tULLInt& duration,
832  tUInteger& days,
833  tUInteger& hours,
834  tUInteger& minutes,
835  tUInteger& seconds,
836  tUInteger& ms);
840  inline static tString getDuration(const tULLInt& duration) {
841 
842  tUInteger days;
843  tUInteger hours;
844  tUInteger minutes;
845  tUInteger seconds;
846  tUInteger ms;
847  return getDuration(duration,days,hours,minutes,seconds,ms);
848  }
849 
850 
854  virtual tString toString() const;
867  tString toString(const tString& format) const;
868 
869 
870 private:
871  static char *_fmt(const struct tm *t, char *pt, const char *ptlim);
872  static char *_conv(const int n, const char *format, char *pt, const char *ptlim);
873  static char *_add(const char *str, char *pt, const char *ptlim);
874 
875  static int getWeek(const struct tm *t);
876  static tUInteger modZ(const tInteger& a,const tInteger& b) {
877  return (a>=0) ? a%b : a%b+b;
878  }
879 
880 
881 };
882 
883 #endif // end of ifndef
const tULLInt & getMilliSeconds() const
return the milliseconds seconds of the time
Definition: CORE_Time.h:363
const tUInteger & getMinutes() const
return the minutes of the time
Definition: CORE_Time.h:343
void setDate(tUInteger year, tUInteger month, tUInteger day)
set the date
Definition: CORE_Time.h:407
tUInteger getDay() const
return the day
Definition: CORE_Time.h:300
const tUInteger & getHours() const
return the hours of the time
Definition: CORE_Time.h:357
static SP::CORE_Time New()
creates a time object
Definition: CORE_Time.h:158
static SP::CORE_Time New(const tUInteger &year, const tUInteger &month, const tUInteger &day)
creates a time object year > 1900 month [1,12] day [1,31]
Definition: CORE_Time.h:203
virtual tString toString() const
return the time into a string
Definition: CORE_Time.cpp:344
void setDate(const tTime &seconds)
set the date from 1900 in seconds
Definition: CORE_Time.cpp:214
void setToNextWeek()
set to next week
Definition: CORE_Time.h:588
const tTime & getSecondsSince1900() const
return the number of seconds since 1900
Definition: CORE_Time.h:369
void startChronoTime()
Definition: CORE_Time.h:635
tULLInt continueChronoTime(const tFlag &f)
Definition: CORE_Time.h:716
tBoolean isAfter(const CORE_Time *t) const
return true if this > t
Definition: CORE_Time.h:765
void setToPreviousWeek()
set to previoust week
Definition: CORE_Time.h:593
static tString getDuration(const tULLInt &duration, tUInteger &days, tUInteger &hours, tUInteger &minutes, tUInteger &seconds, tUInteger &ms)
get duration
Definition: CORE_Time.cpp:598
void setDate(const CORE_Time *time)
set the date from a string year-month-day
Definition: CORE_Time.h:438
#define tUInteger
Definition: types.h:91
this class describes a time class
Definition: CORE_Time.h:64
tULInt continueChronoTime()
contune the chrono and return the time in ms since start time or last continue step the start time be...
Definition: CORE_Time.h:708
static tTime getDateInMilliSeconds()
return the time in 1/60 seconds
Definition: CORE_Time.h:223
void setToFirstWeekDay(const tUInteger &year, const tUInteger &week)
set the date to the first week day
Definition: CORE_Time.cpp:448
tBoolean isAfterOrEqual(const SP::CORE_Time &t) const
return true if this >= t
Definition: CORE_Time.h:816
void setToPreviousMonth()
set to previous month
Definition: CORE_Time.h:577
tString getWeekIntervalString()
get the week interval monday –> Sunday of the current time
Definition: CORE_Time.h:313
tBoolean isBeforeOrEqual(const SP::CORE_Time &t) const
return true if this <= t
Definition: CORE_Time.h:809
void setDate(const tUInteger &year, const tUInteger &month, const tUInteger &day, const tUInteger &hour, const tUInteger &minutes, const tUInteger &seconds)
set the date
Definition: CORE_Time.h:398
static const tFlag HOUR
Definition: CORE_Time.h:85
static tString getDuration(const tULLInt &duration)
get duration
Definition: CORE_Time.h:840
tULLInt getCPUTime() const
return the CPU time in 1/60 seconds
Definition: CORE_Time.h:238
static const tFlag DAY
Definition: CORE_Time.h:83
void setToPreviousDays(const tUInteger &nDays)
sun nDays from current day
Definition: CORE_Time.h:561
tBoolean mIsHRClockChronoStarting
Definition: CORE_Time.h:119
#define tBoolean
Definition: types.h:139
tLLInt sub(const CORE_Time *time) const
get the difference with this and time : this -time in secunds
Definition: CORE_Time.h:507
static const tFlag SECUND
Definition: CORE_Time.h:87
tBoolean isEqual(const CORE_Time *t) const
return true if the 2 dates are equals between this and t
Definition: CORE_Time.h:728
static SP::CORE_Time New(const SP::CORE_Time &time)
creates a time object
Definition: CORE_Time.h:191
tBoolean isEqual(const SP::CORE_Time &t) const
return true if the 2 dates are equals
Definition: CORE_Time.h:788
#define tTime
Definition: types.h:132
tULLInt stopChronoTime(const tFlag &f)
Definition: CORE_Time.h:671
#define null
Definition: types.h:144
static const tString JOURS[]
days names in french
Definition: CORE_Time.h:129
static SP::CORE_Time New(const tTime &time)
creates a time object
Definition: CORE_Time.h:183
static const tFlag SYSTEM_CLOCK_TIME
Definition: CORE_Time.h:73
SP_OBJECT(CORE_Time)
tUInteger mMinutes
Definition: CORE_Time.h:103
static const tFlag MONTH
Definition: CORE_Time.h:81
tBoolean isBefore(const CORE_Time &t) const
return true if this < t
Definition: CORE_Time.h:743
tUInteger mDay
Definition: CORE_Time.h:99
static int getWeek(const struct tm *t)
Definition: CORE_Time.cpp:534
void setDate(const CORE_Time &time)
set the date from a string year-month-day
Definition: CORE_Time.h:420
tBoolean isAfterOrEqual(const CORE_Time &t) const
return true if this >= t
Definition: CORE_Time.h:781
CORE_Time()
create a general time object
Definition: CORE_Time.cpp:96
tULLInt mCPUTime
Definition: CORE_Time.h:109
tLLInt sub(const CORE_Time &time) const
get the difference with time this -time in secunds
Definition: CORE_Time.cpp:265
void setTimeType(const tFlag &f)
set the chrono time type
Definition: CORE_Time.h:614
static const tFlag CLOCK_TIME
Definition: CORE_Time.h:75
#define tULInt
Definition: types.h:39
tUInteger getMonth() const
return the month
Definition: CORE_Time.h:265
#define tLLInt
Definition: types.h:47
this class describes the exceptions raised for CORE package
Definition: CORE_Exception.h:15
static const tFlag WEEK
Definition: CORE_Time.h:82
static char * _add(const char *str, char *pt, const char *ptlim)
Definition: CORE_Time.cpp:593
tUInteger mWeekDay
Definition: CORE_Time.h:97
tLLInt subInMilliSeconds(const CORE_Time &time) const
get the difference between this and time in milli-secunds
Definition: CORE_Time.cpp:273
tLLInt subInMilliSeconds(const SP::CORE_Time &time) const
get the difference between this and time in milli-secunds
Definition: CORE_Time.h:536
const tUInteger & getSeconds() const
return the seconds of the time
Definition: CORE_Time.h:350
static tFlag TIME_TYPE
Definition: CORE_Time.h:78
void setToNextDay()
set to next day
Definition: CORE_Time.h:550
tUInteger mSeconds
Definition: CORE_Time.h:105
void setHour(const tString &h)
set hour of the format HHhMM
Definition: CORE_Time.cpp:509
tBoolean isBeforeOrEqual(const CORE_Time &t) const
return true if this <= t
Definition: CORE_Time.h:774
tUInteger getDaysNumberInMonth() const
return the number of days in month
Definition: CORE_Time.h:272
static char * _fmt(const struct tm *t, char *pt, const char *ptlim)
Definition: CORE_Time.cpp:544
tUInteger mWeek
Definition: CORE_Time.h:95
void setToNextMonth()
set to next month
Definition: CORE_Time.h:566
std::chrono::high_resolution_clock::time_point mStartHRClock
Definition: CORE_Time.h:114
static const tString MOIS[]
month names in french
Definition: CORE_Time.h:136
static const tULLInt MAX_YEAR
MAX number of years.
Definition: CORE_Time.h:71
static tTime getDateInSeconds()
return the time in 1/60 seconds
Definition: CORE_Time.h:215
DEFINE_SPTR(CORE_Time)
static const tFlag MILLI_SECUNDS
Definition: CORE_Time.h:88
tUInteger mMonth
Definition: CORE_Time.h:93
tUInteger mYear
Definition: CORE_Time.h:91
tUInteger getWeekYear(tUInteger &year) const
get the week of the year
Definition: CORE_Time.h:247
abstract base class for most classes.
Definition: CORE_Object.h:53
static const tString DAYS[]
days names in english
Definition: CORE_Time.h:126
static SP::CORE_Time New(const CORE_Time *time)
creates a time object
Definition: CORE_Time.h:175
std::chrono::system_clock::time_point mStartSystemClock
Definition: CORE_Time.h:115
tBoolean isBefore(const CORE_Time *t) const
return true if this < t
Definition: CORE_Time.h:750
void startChronoTime(const tFlag &f)
Definition: CORE_Time.h:642
#define tString
Definition: types.h:135
tLLInt subInMilliSeconds(const CORE_Time *time) const
get the difference with this and time: this -time in milli-secunds
Definition: CORE_Time.h:543
tBoolean mIsSystemClockChronoStarting
Definition: CORE_Time.h:120
static char * _conv(const int n, const char *format, char *pt, const char *ptlim)
Definition: CORE_Time.cpp:585
tBoolean mIsClockChronoStarting
Definition: CORE_Time.h:121
const tUInteger & getWeekDay() const
return the day of the week
Definition: CORE_Time.h:336
void setToLastDay(const tUInteger &year, const tUInteger &month)
set to last day of month
Definition: CORE_Time.h:600
static tUInteger modZ(const tInteger &a, const tInteger &b)
Definition: CORE_Time.h:876
static SP::CORE_Time New(const CORE_Time &time)
creates a time object
Definition: CORE_Time.h:166
void setToPreviousDay()
set to previous day
Definition: CORE_Time.h:555
static tULLInt getTime()
return the time in 1/60 seconds
Definition: CORE_Time.h:232
static const tFlag HR_CLOCK_TIME
Definition: CORE_Time.h:74
static tULLInt getClockTime()
Definition: CORE_Time.h:621
void setToWeekDay(const tUInteger &year, const tUInteger &week, const tUInteger &day)
set the date to the week day
Definition: CORE_Time.cpp:475
void setDate(SP::CORE_Time time)
set the date from a string year-month-day
Definition: CORE_Time.h:432
static tLLInt subTimesInMilliSeconds(const CORE_Time &time1, const CORE_Time &time2)
get the difference betwen two dates in milli-secund : time1-time2
Definition: CORE_Time.cpp:256
virtual ~CORE_Time()
remove
Definition: CORE_Time.cpp:160
static const tFlag YEAR
Definition: CORE_Time.h:80
tULLInt stopChronoTime()
end the chrono and return the time in seconds since start time
Definition: CORE_Time.h:663
tUInteger mHours
Definition: CORE_Time.h:101
tLLInt sub(const SP::CORE_Time &time) const
get the difference with this and time: this -time in secunds
Definition: CORE_Time.h:499
#define tULLInt
Definition: types.h:45
static const tFlag WEEK_DAY
Definition: CORE_Time.h:84
tTime mSecondsSince1900
Definition: CORE_Time.h:111
tBoolean isAfter(const CORE_Time &t) const
return true if this > t
Definition: CORE_Time.h:758
static const tFlag MINUTE
Definition: CORE_Time.h:86
tBoolean isEqual(const CORE_Time &t) const
return true if the 2 dates are equals between this and t
Definition: CORE_Time.h:736
tULLInt mMilliSeconds
Definition: CORE_Time.h:107
tBoolean isAfter(const SP::CORE_Time &t) const
return true if this > t
Definition: CORE_Time.h:802
DEFINE_SVPTR(CORE_Time)
static const tString MONTHS[]
month names in english
Definition: CORE_Time.h:133
static tLLInt subTimes(const CORE_Time &time1, const CORE_Time &time2)
get the difference between two dates in secund time1-time2
Definition: CORE_Time.cpp:253
tBoolean isBefore(const SP::CORE_Time &t) const
return true if this < t
Definition: CORE_Time.h:795
#define tInteger
Definition: types.h:90
const tUInteger & getYear() const
return the year
Definition: CORE_Time.h:258
void setTime(const tUInteger &hour, const tUInteger &minutes, const tUInteger &seconds)
set the time
Definition: CORE_Time.cpp:228
static tULLInt getClockDuration(const tULLInt &startTime)
Definition: CORE_Time.h:628
class Free introduced for deleting a smart pointer
Definition: CORE_Object.h:141
#define tFlag
Definition: types.h:74
tULLInt mStartClock
Definition: CORE_Time.h:116