SNAP Library 2.4, User Reference  2015-05-11 19:40:56
SNAP, a general purpose, high performance system for analysis and manipulation of large networks
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
TTm Class Reference

#include <tm.h>

Public Member Functions

 TTm ()
 
 TTm (const TTm &Tm)
 
 TTm (const int &_Year, const int &_Month, const int &_Day, const int &_DayOfWeek=-1, const int &_Hour=0, const int &_Min=0, const int &_Sec=0, const int &_MSec=0)
 
 TTm (const TSecTm &SecTm)
 
 ~TTm ()
 
 TTm (TSIn &SIn)
 
void Save (TSOut &SOut) const
 
TTmoperator= (const TTm &Tm)
 
bool operator== (const TTm &Tm) const
 
bool operator< (const TTm &Tm) const
 
int GetMemUsed () const
 
int GetPrimHashCd () const
 
int GetSecHashCd () const
 
bool IsDef () const
 
void Undef ()
 
bool IsTimeDef () const
 
int GetYear () const
 
int GetMonth () const
 
TStr GetMonthNm () const
 
int GetDay () const
 
int GetDayOfWeek () const
 
TStr GetDayOfWeekNm () const
 
int GetHour () const
 
int GetMin () const
 
int GetSec () const
 
int GetMSec () const
 
TStr GetStr (const bool &MSecP=true) const
 
TStr GetYMDDashStr () const
 
TStr GetHMSTColonDotStr (const bool &FullP=false, const bool &MSecP=true) const
 
TStr GetWebLogDateStr () const
 
TStr GetWebLogTimeStr () const
 
TStr GetWebLogDateTimeStr (const bool &FullP=false, const TStr &DateTimeSepCh=" ", const bool &MSecP=true) const
 
TStr GetIdStr () const
 
TSecTm GetSecTm () const
 
void AddTime (const int &Hours, const int &Mins=0, const int &Secs=0, const int &MSecs=0)
 
void AddDays (const int &Days)
 
void SubTime (const int &Hours, const int &Mins=0, const int &Secs=0, const int &MSecs=0)
 
void SubDays (const int &Days)
 

Static Public Member Functions

static TTm GetCurUniTm ()
 
static TTm GetUniqueCurUniTm ()
 
static TTm GetUniqueCurUniTm (const int &UniqueSpaces, const int &UniqueSpaceN)
 
static TTm GetCurLocTm ()
 
static uint64 GetCurUniMSecs ()
 
static uint64 GetCurLocMSecs ()
 
static uint64 GetMSecsFromTm (const TTm &Tm)
 
static TTm GetTmFromMSecs (const uint64 &MSecs)
 
static uint GetMSecsFromOsStart ()
 
static uint64 GetPerfTimerFq ()
 
static uint64 GetPerfTimerTicks ()
 
static void GetDiff (const TTm &Tm1, const TTm &Tm2, int &Days, int &Hours, int &Mins, int &Secs, int &MSecs)
 
static uint64 GetDiffMSecs (const TTm &Tm1, const TTm &Tm2)
 
static uint64 GetDiffSecs (const TTm &Tm1, const TTm &Tm2)
 
static uint64 GetDiffMins (const TTm &Tm1, const TTm &Tm2)
 
static uint64 GetDiffHrs (const TTm &Tm1, const TTm &Tm2)
 
static uint64 GetDiffDays (const TTm &Tm1, const TTm &Tm2)
 
static TTm GetLocTmFromUniTm (const TTm &Tm)
 
static TTm GetUniTmFromLocTm (const TTm &Tm)
 
static TTm GetTmFromWebLogTimeStr (const TStr &TimeStr, const char TimeSepCh=':', const char MSecSepCh='.')
 
static TTm GetTmFromWebLogDateTimeStr (const TStr &DateTimeStr, const char DateSepCh='-', const char TimeSepCh=':', const char MSecSepCh='.', const char DateTimeSepCh=' ')
 
static TTm GetTmFromIdStr (const TStr &IdStr)
 
static uint GetDateTimeInt (const int &Year=0, const int &Month=0, const int &Day=1, const int &Hour=0, const int &Min=0, const int &Sec=0)
 
static uint GetDateIntFromTm (const TTm &Tm)
 
static uint GetMonthIntFromTm (const TTm &Tm)
 
static uint GetYearIntFromTm (const TTm &Tm)
 
static uint GetDateTimeIntFromTm (const TTm &Tm)
 
static TTm GetTmFromDateTimeInt (const uint &DateTimeInt)
 
static TSecTm GetSecTmFromDateTimeInt (const uint &DateTimeInt)
 

Private Attributes

TInt Year
 
TInt Month
 
TInt Day
 
TInt DayOfWeek
 
TInt Hour
 
TInt Min
 
TInt Sec
 
TInt MSec
 

Detailed Description

Definition at line 212 of file tm.h.

Constructor & Destructor Documentation

TTm::TTm ( )
inline

Definition at line 217 of file tm.h.

217  :
218  Year(-1), Month(-1), Day(-1), DayOfWeek(-1),
219  Hour(-1), Min(-1), Sec(-1), MSec(-1){}
TInt MSec
Definition: tm.h:215
TInt Day
Definition: tm.h:214
TInt Sec
Definition: tm.h:215
TInt Min
Definition: tm.h:215
TInt Hour
Definition: tm.h:215
TInt Month
Definition: tm.h:214
TInt Year
Definition: tm.h:214
TInt DayOfWeek
Definition: tm.h:214
TTm::TTm ( const TTm Tm)
inline

Definition at line 220 of file tm.h.

220  :
221  Year(Tm.Year), Month(Tm.Month), Day(Tm.Day), DayOfWeek(Tm.DayOfWeek),
222  Hour(Tm.Hour), Min(Tm.Min), Sec(Tm.Sec), MSec(Tm.MSec){}
TInt MSec
Definition: tm.h:215
TInt Day
Definition: tm.h:214
TInt Sec
Definition: tm.h:215
TInt Min
Definition: tm.h:215
TInt Hour
Definition: tm.h:215
TInt Month
Definition: tm.h:214
TInt Year
Definition: tm.h:214
TInt DayOfWeek
Definition: tm.h:214
TTm::TTm ( const int &  _Year,
const int &  _Month,
const int &  _Day,
const int &  _DayOfWeek = -1,
const int &  _Hour = 0,
const int &  _Min = 0,
const int &  _Sec = 0,
const int &  _MSec = 0 
)
inline

Definition at line 223 of file tm.h.

225  :
226  Year(_Year), Month(_Month), Day(_Day), DayOfWeek(_DayOfWeek),
227  Hour(_Hour), Min(_Min), Sec(_Sec), MSec(_MSec){}
TInt MSec
Definition: tm.h:215
TInt Day
Definition: tm.h:214
TInt Sec
Definition: tm.h:215
TInt Min
Definition: tm.h:215
TInt Hour
Definition: tm.h:215
TInt Month
Definition: tm.h:214
TInt Year
Definition: tm.h:214
TInt DayOfWeek
Definition: tm.h:214
TTm::TTm ( const TSecTm SecTm)
inline

Definition at line 228 of file tm.h.

228  :
229  Year(SecTm.GetYearN()), Month(SecTm.GetMonthN()), Day(SecTm.GetDayN()),
230  DayOfWeek(SecTm.GetDayOfWeekN()), Hour(SecTm.GetHourN()),
231  Min(SecTm.GetMinN()), Sec(SecTm.GetSecN()), MSec(0){}
TInt MSec
Definition: tm.h:215
int GetMinN() const
Definition: tm.cpp:597
int GetYearN() const
Definition: tm.cpp:555
int GetDayOfWeekN() const
Definition: tm.cpp:579
TInt Day
Definition: tm.h:214
TInt Sec
Definition: tm.h:215
int GetMonthN() const
Definition: tm.cpp:561
TInt Min
Definition: tm.h:215
TInt Hour
Definition: tm.h:215
TInt Month
Definition: tm.h:214
int GetSecN() const
Definition: tm.cpp:603
int GetHourN() const
Definition: tm.cpp:591
int GetDayN() const
Definition: tm.cpp:573
TInt Year
Definition: tm.h:214
TInt DayOfWeek
Definition: tm.h:214
TTm::~TTm ( )
inline

Definition at line 232 of file tm.h.

232 {}
TTm::TTm ( TSIn SIn)
inline

Definition at line 233 of file tm.h.

233  :
234  Year(SIn), Month(SIn), Day(SIn), DayOfWeek(SIn),
235  Hour(SIn), Min(SIn), Sec(SIn), MSec(SIn){}
TInt MSec
Definition: tm.h:215
TInt Day
Definition: tm.h:214
TInt Sec
Definition: tm.h:215
TInt Min
Definition: tm.h:215
TInt Hour
Definition: tm.h:215
TInt Month
Definition: tm.h:214
TInt Year
Definition: tm.h:214
TInt DayOfWeek
Definition: tm.h:214

Member Function Documentation

void TTm::AddDays ( const int &  Days)
inline

Definition at line 299 of file tm.h.

299 {AddTime(Days*24);}
void AddTime(const int &Hours, const int &Mins=0, const int &Secs=0, const int &MSecs=0)
Definition: tm.cpp:1004
void TTm::AddTime ( const int &  Hours,
const int &  Mins = 0,
const int &  Secs = 0,
const int &  MSecs = 0 
)

Definition at line 1004 of file tm.cpp.

1005  {
1006  uint64 TmMSecs=TTm::GetMSecsFromTm(*this);
1007  TmMSecs+=(uint64(Hours)*uint64(3600)*uint64(1000));
1008  TmMSecs+=(uint64(Mins)*uint64(60)*uint64(1000));
1009  TmMSecs+=(uint64(Secs)*uint64(1000));
1010  TmMSecs+=uint64(MSecs);
1011  *this=GetTmFromMSecs(TmMSecs);
1012 }
unsigned long long uint64
Definition: bd.h:38
static TTm GetTmFromMSecs(const uint64 &MSecs)
Definition: tm.cpp:1071
static uint64 GetMSecsFromTm(const TTm &Tm)
Definition: tm.cpp:1067
uint64 TTm::GetCurLocMSecs ( )
static

Definition at line 1063 of file tm.cpp.

1063  {
1064  return TSysTm::GetCurLocMSecs();
1065 }
TTm TTm::GetCurLocTm ( )
static

Definition at line 1055 of file tm.cpp.

1055  {
1056  return TSysTm::GetCurLocTm();
1057 }
uint64 TTm::GetCurUniMSecs ( )
static

Definition at line 1059 of file tm.cpp.

1059  {
1060  return TSysTm::GetCurUniMSecs();
1061 }
TTm TTm::GetCurUniTm ( )
static

Definition at line 1024 of file tm.cpp.

1024  {
1025  return TSysTm::GetCurUniTm();
1026 }
uint TTm::GetDateIntFromTm ( const TTm Tm)
static

Definition at line 1237 of file tm.cpp.

1237  {
1238  return Tm.IsDef() ? GetDateTimeInt(Tm.GetYear(), Tm.GetMonth(), Tm.GetDay()) : 0;
1239 }
int GetMonth() const
Definition: tm.h:275
static uint GetDateTimeInt(const int &Year=0, const int &Month=0, const int &Day=1, const int &Hour=0, const int &Min=0, const int &Sec=0)
Definition: tm.cpp:1231
int GetYear() const
Definition: tm.h:274
int GetDay() const
Definition: tm.h:277
bool IsDef() const
Definition: tm.h:264
uint TTm::GetDateTimeInt ( const int &  Year = 0,
const int &  Month = 0,
const int &  Day = 1,
const int &  Hour = 0,
const int &  Min = 0,
const int &  Sec = 0 
)
static

Definition at line 1231 of file tm.cpp.

1232  {
1233 
1234  return TSecTm(Year, Month, Day, Hour, Min, Sec).GetAbsSecs();
1235 }
TInt Day
Definition: tm.h:214
TInt Sec
Definition: tm.h:215
TInt Min
Definition: tm.h:215
TInt Hour
Definition: tm.h:215
TInt Month
Definition: tm.h:214
uint GetAbsSecs() const
Definition: tm.h:149
TInt Year
Definition: tm.h:214
Definition: tm.h:81
uint TTm::GetDateTimeIntFromTm ( const TTm Tm)
static

Definition at line 1249 of file tm.cpp.

1249  {
1250  return Tm.IsDef() ?
1251  GetDateTimeInt(Tm.GetYear(), Tm.GetMonth(),
1252  Tm.GetDay(), Tm.GetHour(), Tm.GetMin(), Tm.GetSec()) : 0;
1253 }
int GetMin() const
Definition: tm.h:281
int GetMonth() const
Definition: tm.h:275
static uint GetDateTimeInt(const int &Year=0, const int &Month=0, const int &Day=1, const int &Hour=0, const int &Min=0, const int &Sec=0)
Definition: tm.cpp:1231
int GetHour() const
Definition: tm.h:280
int GetYear() const
Definition: tm.h:274
int GetDay() const
Definition: tm.h:277
bool IsDef() const
Definition: tm.h:264
int GetSec() const
Definition: tm.h:282
int TTm::GetDay ( ) const
inline

Definition at line 277 of file tm.h.

277 {return Day;}
TInt Day
Definition: tm.h:214
int TTm::GetDayOfWeek ( ) const
inline

Definition at line 278 of file tm.h.

278 {return DayOfWeek;}
TInt DayOfWeek
Definition: tm.h:214
TStr TTm::GetDayOfWeekNm ( ) const
inline

Definition at line 279 of file tm.h.

static TStr GetDayOfWeekNm(const int &DayOfWeekN, const TLoc &Loc=lUs)
Definition: tm.cpp:71
TInt DayOfWeek
Definition: tm.h:214
void TTm::GetDiff ( const TTm Tm1,
const TTm Tm2,
int &  Days,
int &  Hours,
int &  Mins,
int &  Secs,
int &  MSecs 
)
static

Definition at line 1087 of file tm.cpp.

1088  {
1089 
1090  const uint64 DiffMSecs = TTm::GetDiffMSecs(Tm1, Tm2);
1091  const uint64 DiffSecs = DiffMSecs / 1000;
1092  const uint64 DiffMins = DiffSecs / 60;
1093  const uint64 DiffHours = DiffMins / 60;
1094 
1095  MSecs = int(DiffMSecs % 1000);
1096  Secs = int(DiffSecs % 60);
1097  Mins = int(DiffMins % 60);
1098  Hours = int(DiffHours % 24);
1099  Days = int((int)DiffHours / 24);
1100 }
static uint64 GetDiffMSecs(const TTm &Tm1, const TTm &Tm2)
Definition: tm.cpp:1102
unsigned long long uint64
Definition: bd.h:38
static uint64 TTm::GetDiffDays ( const TTm Tm1,
const TTm Tm2 
)
inlinestatic

Definition at line 324 of file tm.h.

324  {
325  return GetDiffMSecs(Tm1, Tm2)/uint64(1000*60*60*24);}
static uint64 GetDiffMSecs(const TTm &Tm1, const TTm &Tm2)
Definition: tm.cpp:1102
unsigned long long uint64
Definition: bd.h:38
static uint64 TTm::GetDiffHrs ( const TTm Tm1,
const TTm Tm2 
)
inlinestatic

Definition at line 322 of file tm.h.

322  {
323  return GetDiffMSecs(Tm1, Tm2)/uint64(1000*60*60);}
static uint64 GetDiffMSecs(const TTm &Tm1, const TTm &Tm2)
Definition: tm.cpp:1102
unsigned long long uint64
Definition: bd.h:38
static uint64 TTm::GetDiffMins ( const TTm Tm1,
const TTm Tm2 
)
inlinestatic

Definition at line 320 of file tm.h.

320  {
321  return GetDiffMSecs(Tm1, Tm2)/uint64(1000*60);}
static uint64 GetDiffMSecs(const TTm &Tm1, const TTm &Tm2)
Definition: tm.cpp:1102
unsigned long long uint64
Definition: bd.h:38
uint64 TTm::GetDiffMSecs ( const TTm Tm1,
const TTm Tm2 
)
static

Definition at line 1102 of file tm.cpp.

1102  {
1103  uint64 Tm1MSecs=GetMSecsFromTm(Tm1);
1104  uint64 Tm2MSecs=GetMSecsFromTm(Tm2);
1105  if (Tm1MSecs>Tm2MSecs){
1106  return Tm1MSecs-Tm2MSecs;
1107  } else {
1108  return Tm2MSecs-Tm1MSecs;
1109  }
1110 }
unsigned long long uint64
Definition: bd.h:38
static uint64 GetMSecsFromTm(const TTm &Tm)
Definition: tm.cpp:1067
static uint64 TTm::GetDiffSecs ( const TTm Tm1,
const TTm Tm2 
)
inlinestatic

Definition at line 318 of file tm.h.

318  {
319  return GetDiffMSecs(Tm1, Tm2)/uint64(1000);}
static uint64 GetDiffMSecs(const TTm &Tm1, const TTm &Tm2)
Definition: tm.cpp:1102
unsigned long long uint64
Definition: bd.h:38
TStr TTm::GetHMSTColonDotStr ( const bool &  FullP = false,
const bool &  MSecP = true 
) const

Definition at line 978 of file tm.cpp.

978  {
979  TChA ChA;
980  ChA+=TInt::GetStr(Hour, "%02d");
981  ChA+=':'; ChA+=TInt::GetStr(Min, "%02d");
982  if (FullP||((Sec!=0)||(MSec!=0))){
983  ChA+=':'; ChA+=TInt::GetStr(Sec, "%02d");
984  if ((MSecP)&&(FullP||(MSec!=0))){
985  ChA+='.'; ChA+=TInt::GetStr(MSec, "%d");
986  }
987  }
988  return ChA;
989 }
TInt MSec
Definition: tm.h:215
TStr GetStr() const
Definition: dt.h:1105
TInt Sec
Definition: tm.h:215
TInt Min
Definition: tm.h:215
TInt Hour
Definition: tm.h:215
Definition: dt.h:201
int TTm::GetHour ( ) const
inline

Definition at line 280 of file tm.h.

280 {return Hour;}
TInt Hour
Definition: tm.h:215
TStr TTm::GetIdStr ( ) const

Definition at line 991 of file tm.cpp.

991  {
992  TChA ChA;
993  ChA+=TInt::GetStr(Year%100, "%02d");
994  ChA+=TInt::GetStr(Month, "%02d");
995  ChA+=TInt::GetStr(Day, "%02d");
996  ChA+=TInt::GetStr(Hour, "%02d");
997  ChA+=TInt::GetStr(Min, "%02d");
998  ChA+=TInt::GetStr(Sec, "%02d");
999  ChA+=TInt::GetStr(MSec, "%03d");
1000  return ChA;
1001 }
TInt MSec
Definition: tm.h:215
TStr GetStr() const
Definition: dt.h:1105
TInt Day
Definition: tm.h:214
TInt Sec
Definition: tm.h:215
TInt Min
Definition: tm.h:215
TInt Hour
Definition: tm.h:215
TInt Month
Definition: tm.h:214
TInt Year
Definition: tm.h:214
Definition: dt.h:201
TTm TTm::GetLocTmFromUniTm ( const TTm Tm)
static

Definition at line 1112 of file tm.cpp.

1112  {
1113  return TSysTm::GetLocTmFromUniTm(Tm);
1114 }
int TTm::GetMemUsed ( ) const
inline

Definition at line 258 of file tm.h.

258 {return sizeof(TTm);}
TTm()
Definition: tm.h:217
int TTm::GetMin ( ) const
inline

Definition at line 281 of file tm.h.

281 {return Min;}
TInt Min
Definition: tm.h:215
int TTm::GetMonth ( ) const
inline

Definition at line 275 of file tm.h.

275 {return Month;}
TInt Month
Definition: tm.h:214
uint TTm::GetMonthIntFromTm ( const TTm Tm)
static

Definition at line 1241 of file tm.cpp.

1241  {
1242  return Tm.IsDef() ? GetDateTimeInt(Tm.GetYear(), Tm.GetMonth()) : 0;
1243 }
int GetMonth() const
Definition: tm.h:275
static uint GetDateTimeInt(const int &Year=0, const int &Month=0, const int &Day=1, const int &Hour=0, const int &Min=0, const int &Sec=0)
Definition: tm.cpp:1231
int GetYear() const
Definition: tm.h:274
bool IsDef() const
Definition: tm.h:264
TStr TTm::GetMonthNm ( ) const
inline

Definition at line 276 of file tm.h.

276 {return TTmInfo::GetMonthNm(Month+1);}
TInt Month
Definition: tm.h:214
static TStr GetMonthNm(const int &MonthN, const TLoc &Loc=lUs)
Definition: tm.cpp:50
int TTm::GetMSec ( ) const
inline

Definition at line 283 of file tm.h.

283 {return MSec;}
TInt MSec
Definition: tm.h:215
uint TTm::GetMSecsFromOsStart ( )
static

Definition at line 1075 of file tm.cpp.

1075  {
1076  return TSysTm::GetMSecsFromOsStart();
1077 }
uint64 TTm::GetMSecsFromTm ( const TTm Tm)
static

Definition at line 1067 of file tm.cpp.

1067  {
1068  return TSysTm::GetMSecsFromTm(Tm);
1069 }
uint64 TTm::GetPerfTimerFq ( )
static

Definition at line 1079 of file tm.cpp.

1079  {
1080  return TSysTm::GetPerfTimerFq();
1081 }
uint64 TTm::GetPerfTimerTicks ( )
static

Definition at line 1083 of file tm.cpp.

1083  {
1084  return TSysTm::GetPerfTimerTicks();
1085 }
int TTm::GetPrimHashCd ( ) const
inline

Definition at line 260 of file tm.h.

260 {return Year*Month*Day+Hour*Min*Sec*MSec;}
TInt MSec
Definition: tm.h:215
TInt Day
Definition: tm.h:214
TInt Sec
Definition: tm.h:215
TInt Min
Definition: tm.h:215
TInt Hour
Definition: tm.h:215
TInt Month
Definition: tm.h:214
TInt Year
Definition: tm.h:214
int TTm::GetSec ( ) const
inline

Definition at line 282 of file tm.h.

282 {return Sec;}
TInt Sec
Definition: tm.h:215
int TTm::GetSecHashCd ( ) const
inline

Definition at line 261 of file tm.h.

261 {return Year*Month*Day;}
TInt Day
Definition: tm.h:214
TInt Month
Definition: tm.h:214
TInt Year
Definition: tm.h:214
TSecTm TTm::GetSecTm ( ) const
inline

Definition at line 294 of file tm.h.

294  {
295  return TSecTm(Year, Month, Day, Hour, Min, Sec);}
TInt Day
Definition: tm.h:214
TInt Sec
Definition: tm.h:215
TInt Min
Definition: tm.h:215
TInt Hour
Definition: tm.h:215
TInt Month
Definition: tm.h:214
TInt Year
Definition: tm.h:214
Definition: tm.h:81
TSecTm TTm::GetSecTmFromDateTimeInt ( const uint DateTimeInt)
static

Definition at line 1260 of file tm.cpp.

1260  {
1261  if (DateTimeInt == 0) { return TSecTm(); }
1262  return TSecTm(DateTimeInt);
1263 }
Definition: tm.h:81
TStr TTm::GetStr ( const bool &  MSecP = true) const

Definition at line 956 of file tm.cpp.

956  {
957  TChA ChA;
958  ChA+=TInt::GetStr(Year, "%04d"); ChA+='-';
959 // ChA+=GetMonthNm(); ChA+='-';
960  ChA+=TInt::GetStr(Month, "%02d"); ChA+='-';
961  ChA+=TInt::GetStr(Day, "%02d"); ChA+=' ';
962 // ChA+=GetDayOfWeekNm(); ChA+=' ';
963  ChA+=TInt::GetStr(Hour, "%02d"); ChA+=':';
964  ChA+=TInt::GetStr(Min, "%02d"); ChA+=':';
965  ChA+=TInt::GetStr(Sec, "%02d");
966  if (MSecP){ChA+='.'; ChA+=TInt::GetStr(MSec, "%03d");}
967  return ChA;
968 }
TInt MSec
Definition: tm.h:215
TStr GetStr() const
Definition: dt.h:1105
TInt Day
Definition: tm.h:214
TInt Sec
Definition: tm.h:215
TInt Min
Definition: tm.h:215
TInt Hour
Definition: tm.h:215
TInt Month
Definition: tm.h:214
TInt Year
Definition: tm.h:214
Definition: dt.h:201
TTm TTm::GetTmFromDateTimeInt ( const uint DateTimeInt)
static

Definition at line 1255 of file tm.cpp.

1255  {
1256  if (DateTimeInt == 0) { return TTm(); }
1257  return TTm(TSecTm(DateTimeInt));
1258 }
TTm()
Definition: tm.h:217
Definition: tm.h:81
TTm TTm::GetTmFromIdStr ( const TStr IdStr)
static

Definition at line 1210 of file tm.cpp.

1210  {
1211  // normalize
1212  TChA IdChA=IdStr;
1213  if (IdChA.Len()==14){
1214  IdChA.Ins(0, "0");}
1215  // check
1216  IAssert(IdChA.Len()==15);
1217  for (int ChN=0; ChN<IdChA.Len(); ChN++){
1218  IAssert(TCh::IsNum(IdChA[ChN]));}
1219  // extract parts
1220  int YearN=2000+(TStr(IdChA[0])+TStr(IdChA[1])).GetInt();
1221  int MonthN=(TStr(IdChA[2])+TStr(IdChA[3])).GetInt();
1222  int DayN=(TStr(IdChA[4])+TStr(IdChA[5])).GetInt();
1223  int HourN=(TStr(IdChA[6])+TStr(IdChA[7])).GetInt();
1224  int MinN=(TStr(IdChA[8])+TStr(IdChA[9])).GetInt();
1225  int SecN=(TStr(IdChA[10])+TStr(IdChA[11])).GetInt();
1226  int MSecN=(TStr(IdChA[12])+TStr(IdChA[13])+TStr(IdChA[14])).GetInt();
1227  TTm Tm=TTm(YearN, MonthN, DayN, -1, HourN, MinN, SecN, MSecN);
1228  return Tm;
1229 }
#define IAssert(Cond)
Definition: bd.h:262
void Ins(const int &BChN, const char *CStr)
Definition: dt.cpp:407
static bool IsNum(const char &Ch)
Definition: dt.h:972
int Len() const
Definition: dt.h:259
TTm()
Definition: tm.h:217
Definition: tm.h:212
Definition: dt.h:201
Definition: dt.h:412
TTm TTm::GetTmFromMSecs ( const uint64 MSecs)
static

Definition at line 1071 of file tm.cpp.

1071  {
1072  return TSysTm::GetTmFromMSecs(MSecs);
1073 }
TTm TTm::GetTmFromWebLogDateTimeStr ( const TStr DateTimeStr,
const char  DateSepCh = '-',
const char  TimeSepCh = ':',
const char  MSecSepCh = '.',
const char  DateTimeSepCh = ' ' 
)
static

Definition at line 1154 of file tm.cpp.

1156  {
1157  int DateTimeStrLen=DateTimeStr.Len();
1158  // year
1159  TChA ChA; int ChN=0;
1160  while ((ChN<DateTimeStrLen)&&(DateTimeStr[ChN]!=DateSepCh)){
1161  ChA+=DateTimeStr[ChN]; ChN++;}
1162  TStr YearStr=ChA;
1163  // month
1164  ChA.Clr(); ChN++;
1165  while ((ChN<DateTimeStrLen)&&(DateTimeStr[ChN]!=DateSepCh)){
1166  ChA+=DateTimeStr[ChN]; ChN++;}
1167  TStr MonthStr=ChA;
1168  // day
1169  ChA.Clr(); ChN++;
1170  while ((ChN<DateTimeStrLen)&&(DateTimeStr[ChN]!=DateTimeSepCh)){
1171  ChA+=DateTimeStr[ChN]; ChN++;}
1172  TStr DayStr=ChA;
1173  // hour
1174  ChA.Clr(); ChN++;
1175  while ((ChN<DateTimeStrLen)&&(DateTimeStr[ChN]!=TimeSepCh)){
1176  ChA+=DateTimeStr[ChN]; ChN++;}
1177  TStr HourStr=ChA;
1178  // minute
1179  ChA.Clr(); ChN++;
1180  while ((ChN<DateTimeStrLen)&&(DateTimeStr[ChN]!=TimeSepCh)){
1181  ChA+=DateTimeStr[ChN]; ChN++;}
1182  TStr MinStr=ChA;
1183  // second
1184  ChA.Clr(); ChN++;
1185  while ((ChN<DateTimeStrLen)&&(DateTimeStr[ChN]!=MSecSepCh)){
1186  ChA+=DateTimeStr[ChN]; ChN++;}
1187  TStr SecStr=ChA;
1188  // mili-second
1189  ChA.Clr(); ChN++;
1190  while (ChN<DateTimeStrLen){
1191  ChA+=DateTimeStr[ChN]; ChN++;}
1192  TStr MSecStr=ChA;
1193  // transform to numbers
1194  int YearN=YearStr.GetInt(-1);
1195  int MonthN=MonthStr.GetInt(-1);
1196  int DayN=DayStr.GetInt(-1);
1197  int HourN=HourStr.GetInt(0);
1198  int MinN=MinStr.GetInt(0);
1199  int SecN=SecStr.GetInt(0);
1200  int MSecN=MSecStr.GetInt(0);
1201  // construct time
1202  TTm Tm;
1203  if ((YearN!=-1)&&(MonthN!=-1)&&(DayN!=-1)){
1204  Tm=TTm(YearN, MonthN, DayN, -1, HourN, MinN, SecN, MSecN);
1205  }
1206  // return time
1207  return Tm;
1208 }
int GetInt() const
Definition: dt.h:579
int Len() const
Definition: dt.h:487
void Clr()
Definition: dt.h:258
TTm()
Definition: tm.h:217
Definition: tm.h:212
Definition: dt.h:201
Definition: dt.h:412
TTm TTm::GetTmFromWebLogTimeStr ( const TStr TimeStr,
const char  TimeSepCh = ':',
const char  MSecSepCh = '.' 
)
static

Definition at line 1120 of file tm.cpp.

1121  {
1122  int TimeStrLen=TimeStr.Len();
1123  // year
1124  TChA ChA; int ChN=0;
1125  while ((ChN<TimeStrLen)&&(TimeStr[ChN]!=TimeSepCh)){
1126  ChA+=TimeStr[ChN]; ChN++;}
1127  TStr HourStr=ChA;
1128  // minute
1129  ChA.Clr(); ChN++;
1130  while ((ChN<TimeStrLen)&&(TimeStr[ChN]!=TimeSepCh)){
1131  ChA+=TimeStr[ChN]; ChN++;}
1132  TStr MinStr=ChA;
1133  // second
1134  ChA.Clr(); ChN++;
1135  while ((ChN<TimeStrLen)&&(TimeStr[ChN]!=MSecSepCh)){
1136  ChA+=TimeStr[ChN]; ChN++;}
1137  TStr SecStr=ChA;
1138  // mili-second
1139  ChA.Clr(); ChN++;
1140  while (ChN<TimeStrLen){
1141  ChA+=TimeStr[ChN]; ChN++;}
1142  TStr MSecStr=ChA;
1143  // transform to numbers
1144  int HourN=HourStr.GetInt(0);
1145  int MinN=MinStr.GetInt(0);
1146  int SecN=SecStr.GetInt(0);
1147  int MSecN=MSecStr.GetInt(0);
1148  // construct time
1149  TTm Tm(-1, -1, -1, -1, HourN, MinN, SecN, MSecN);
1150  // return time
1151  return Tm;
1152 }
int GetInt() const
Definition: dt.h:579
int Len() const
Definition: dt.h:487
void Clr()
Definition: dt.h:258
Definition: tm.h:212
Definition: dt.h:201
Definition: dt.h:412
TTm TTm::GetUniqueCurUniTm ( )
static

Definition at line 1028 of file tm.cpp.

1028  {
1029  static TTm LastUniqueTm=TSysTm::GetCurUniTm();
1030  TTm CurUniqueTm=TSysTm::GetCurUniTm();
1031  if (CurUniqueTm<LastUniqueTm){CurUniqueTm=LastUniqueTm;}
1032  if (CurUniqueTm==LastUniqueTm){CurUniqueTm.AddTime(0, 0, 0, 1);}
1033  LastUniqueTm=CurUniqueTm;
1034  return CurUniqueTm;
1035 }
Definition: tm.h:212
void AddTime(const int &Hours, const int &Mins=0, const int &Secs=0, const int &MSecs=0)
Definition: tm.cpp:1004
TTm TTm::GetUniqueCurUniTm ( const int &  UniqueSpaces,
const int &  UniqueSpaceN 
)
static

Definition at line 1037 of file tm.cpp.

1037  {
1038  static uint64 LastMUniqueTmMSecs=TSysTm::GetCurUniMSecs();
1039  // uniqueness-space-parameters range-check
1040  Assert(UniqueSpaces>=1&&UniqueSpaceN>=0&&UniqueSpaceN<UniqueSpaces);
1041  // get current time
1042  uint64 CurUniqueTmMSecs=TSysTm::GetCurUniMSecs();
1043  if (CurUniqueTmMSecs<LastMUniqueTmMSecs){CurUniqueTmMSecs=LastMUniqueTmMSecs;}
1044  // normalize to uniqueness-space-grid
1045  CurUniqueTmMSecs-=CurUniqueTmMSecs%UniqueSpaces; CurUniqueTmMSecs+=UniqueSpaceN;
1046  // get next free unique-time
1047  if (CurUniqueTmMSecs<=LastMUniqueTmMSecs){
1048  CurUniqueTmMSecs+=UniqueSpaces;
1049  }
1050  // update last-time
1051  LastMUniqueTmMSecs=CurUniqueTmMSecs;
1052  return GetTmFromMSecs(CurUniqueTmMSecs);
1053 }
unsigned long long uint64
Definition: bd.h:38
#define Assert(Cond)
Definition: bd.h:251
static TTm GetTmFromMSecs(const uint64 &MSecs)
Definition: tm.cpp:1071
TTm TTm::GetUniTmFromLocTm ( const TTm Tm)
static

Definition at line 1116 of file tm.cpp.

1116  {
1117  return TSysTm::GetUniTmFromLocTm(Tm);
1118 }
TStr TTm::GetWebLogDateStr ( ) const
inline

Definition at line 289 of file tm.h.

289 {return GetYMDDashStr();}
TStr GetYMDDashStr() const
Definition: tm.cpp:970
TStr TTm::GetWebLogDateTimeStr ( const bool &  FullP = false,
const TStr DateTimeSepCh = " ",
const bool &  MSecP = true 
) const
inline

Definition at line 291 of file tm.h.

291  {
292  return GetYMDDashStr()+DateTimeSepCh+GetHMSTColonDotStr(FullP, MSecP);}
TStr GetYMDDashStr() const
Definition: tm.cpp:970
TStr GetHMSTColonDotStr(const bool &FullP=false, const bool &MSecP=true) const
Definition: tm.cpp:978
TStr TTm::GetWebLogTimeStr ( ) const
inline

Definition at line 290 of file tm.h.

290 {return GetHMSTColonDotStr(false);}
TStr GetHMSTColonDotStr(const bool &FullP=false, const bool &MSecP=true) const
Definition: tm.cpp:978
int TTm::GetYear ( ) const
inline

Definition at line 274 of file tm.h.

274 {return Year;}
TInt Year
Definition: tm.h:214
uint TTm::GetYearIntFromTm ( const TTm Tm)
static

Definition at line 1245 of file tm.cpp.

1245  {
1246  return Tm.IsDef() ? GetDateTimeInt(Tm.GetYear()) : 0;
1247 }
static uint GetDateTimeInt(const int &Year=0, const int &Month=0, const int &Day=1, const int &Hour=0, const int &Min=0, const int &Sec=0)
Definition: tm.cpp:1231
int GetYear() const
Definition: tm.h:274
bool IsDef() const
Definition: tm.h:264
TStr TTm::GetYMDDashStr ( ) const

Definition at line 970 of file tm.cpp.

970  {
971  TChA ChA;
972  ChA+=TInt::GetStr(Year, "%04d");
973  ChA+='-'; ChA+=TInt::GetStr(Month, "%02d");
974  ChA+='-'; ChA+=TInt::GetStr(Day, "%02d");
975  return ChA;
976 }
TStr GetStr() const
Definition: dt.h:1105
TInt Day
Definition: tm.h:214
TInt Month
Definition: tm.h:214
TInt Year
Definition: tm.h:214
Definition: dt.h:201
bool TTm::IsDef ( ) const
inline

Definition at line 264 of file tm.h.

264  {
265  return (Year!=-1)&&(Month!=-1)&&(Day!=-1)&&
266  (Hour!=-1)&&(Min!=-1)&&(Sec!=-1)&&(MSec!=-1);}
TInt MSec
Definition: tm.h:215
TInt Day
Definition: tm.h:214
TInt Sec
Definition: tm.h:215
TInt Min
Definition: tm.h:215
TInt Hour
Definition: tm.h:215
TInt Month
Definition: tm.h:214
TInt Year
Definition: tm.h:214
bool TTm::IsTimeDef ( ) const
inline

Definition at line 271 of file tm.h.

271 { return !(Hour==0 && Min==0 && Sec==0 && MSec==0); }
TInt MSec
Definition: tm.h:215
TInt Sec
Definition: tm.h:215
TInt Min
Definition: tm.h:215
TInt Hour
Definition: tm.h:215
bool TTm::operator< ( const TTm Tm) const
inline

Definition at line 248 of file tm.h.

248  {
249  return
250  (Year<Tm.Year)||
251  ((Year==Tm.Year)&&(Month<Tm.Month))||
252  ((Year==Tm.Year)&&(Month==Tm.Month)&&(Day<Tm.Day))||
253  (((Year==Tm.Year)&&(Month==Tm.Month)&&(Day==Tm.Day))&&(
254  (Hour<Tm.Hour)||
255  ((Hour==Tm.Hour)&&(Min<Tm.Min))||
256  ((Hour==Tm.Hour)&&(Min==Tm.Min)&&(Sec<Tm.Sec))||
257  ((Hour==Tm.Hour)&&(Min==Tm.Min)&&(Sec==Tm.Sec)&&(MSec<Tm.MSec))));} // saxo
TInt MSec
Definition: tm.h:215
TInt Day
Definition: tm.h:214
TInt Sec
Definition: tm.h:215
TInt Min
Definition: tm.h:215
TInt Hour
Definition: tm.h:215
TInt Month
Definition: tm.h:214
TInt Year
Definition: tm.h:214
TTm& TTm::operator= ( const TTm Tm)
inline

Definition at line 240 of file tm.h.

240  {
241  Year=Tm.Year; Month=Tm.Month; Day=Tm.Day; DayOfWeek=Tm.DayOfWeek;
242  Hour=Tm.Hour; Min=Tm.Min; Sec=Tm.Sec; MSec=Tm.MSec;
243  return *this;}
TInt MSec
Definition: tm.h:215
TInt Day
Definition: tm.h:214
TInt Sec
Definition: tm.h:215
TInt Min
Definition: tm.h:215
TInt Hour
Definition: tm.h:215
TInt Month
Definition: tm.h:214
TInt Year
Definition: tm.h:214
TInt DayOfWeek
Definition: tm.h:214
bool TTm::operator== ( const TTm Tm) const
inline

Definition at line 244 of file tm.h.

244  {
245  return
246  (Year==Tm.Year)&&(Month==Tm.Month)&&(Day==Tm.Day)&&
247  (Hour==Tm.Hour)&&(Min==Tm.Min)&&(Sec==Tm.Sec)&&(MSec==Tm.MSec);}
TInt MSec
Definition: tm.h:215
TInt Day
Definition: tm.h:214
TInt Sec
Definition: tm.h:215
TInt Min
Definition: tm.h:215
TInt Hour
Definition: tm.h:215
TInt Month
Definition: tm.h:214
TInt Year
Definition: tm.h:214
void TTm::Save ( TSOut SOut) const
inline

Definition at line 236 of file tm.h.

236  {
237  Year.Save(SOut); Month.Save(SOut); Day.Save(SOut); DayOfWeek.Save(SOut);
238  Hour.Save(SOut); Min.Save(SOut); Sec.Save(SOut); MSec.Save(SOut);}
TInt MSec
Definition: tm.h:215
void Save(TSOut &SOut) const
Definition: dt.h:1058
TInt Day
Definition: tm.h:214
TInt Sec
Definition: tm.h:215
TInt Min
Definition: tm.h:215
TInt Hour
Definition: tm.h:215
TInt Month
Definition: tm.h:214
TInt Year
Definition: tm.h:214
TInt DayOfWeek
Definition: tm.h:214
void TTm::SubDays ( const int &  Days)
inline

Definition at line 301 of file tm.h.

301 {SubTime(Days*24);}
void SubTime(const int &Hours, const int &Mins=0, const int &Secs=0, const int &MSecs=0)
Definition: tm.cpp:1014
void TTm::SubTime ( const int &  Hours,
const int &  Mins = 0,
const int &  Secs = 0,
const int &  MSecs = 0 
)

Definition at line 1014 of file tm.cpp.

1015  {
1016  uint64 TmMSecs=TTm::GetMSecsFromTm(*this);
1017  TmMSecs-=(uint64(Hours)*uint64(3600)*uint64(1000));
1018  TmMSecs-=(uint64(Mins)*uint64(60)*uint64(1000));
1019  TmMSecs-=(uint64(Secs)*uint64(1000));
1020  TmMSecs-=(uint64(MSecs));
1021  *this=GetTmFromMSecs(TmMSecs);
1022 }
unsigned long long uint64
Definition: bd.h:38
static TTm GetTmFromMSecs(const uint64 &MSecs)
Definition: tm.cpp:1071
static uint64 GetMSecsFromTm(const TTm &Tm)
Definition: tm.cpp:1067
void TTm::Undef ( )
inline

Definition at line 267 of file tm.h.

267  {
268  Year=-1; Month=-1; Day=-1; DayOfWeek=-1;
269  Hour=-1; Min=-1; Sec=-1; MSec=-1;}
TInt MSec
Definition: tm.h:215
TInt Day
Definition: tm.h:214
TInt Sec
Definition: tm.h:215
TInt Min
Definition: tm.h:215
TInt Hour
Definition: tm.h:215
TInt Month
Definition: tm.h:214
TInt Year
Definition: tm.h:214
TInt DayOfWeek
Definition: tm.h:214

Member Data Documentation

TInt TTm::Day
private

Definition at line 214 of file tm.h.

TInt TTm::DayOfWeek
private

Definition at line 214 of file tm.h.

TInt TTm::Hour
private

Definition at line 215 of file tm.h.

TInt TTm::Min
private

Definition at line 215 of file tm.h.

TInt TTm::Month
private

Definition at line 214 of file tm.h.

TInt TTm::MSec
private

Definition at line 215 of file tm.h.

TInt TTm::Sec
private

Definition at line 215 of file tm.h.

TInt TTm::Year
private

Definition at line 214 of file tm.h.


The documentation for this class was generated from the following files: