47   if (MonthN==-1){
return -1;} 
else {
return MonthN+1;}
 
   52   IAssert((1<=MonthN)&&(MonthN<=12));
 
   68   if (DayOfWeekN==-1){
return -1;} 
else {
return DayOfWeekN+1;}
 
   73   IAssert((1<=DayOfWeekN)&&(DayOfWeekN<=7));
 
   87     case tmuYear : 
return 365*24*3600;
 
   89     case tmuWeek : 
return 7*24*3600;
 
   90     case tmuDay : 
return 24*3600;
 
  113     case tmuDay : 
return "Day";
 
  119     case tmu30Min : 
return "30 Minutes";
 
  120     case tmu15Min : 
return "15 Minutes";
 
  121     case tmu10Min : 
return "10 Minutes";
 
  122     case tmu1Min : 
return "Minute";
 
  123     case tmu1Sec : 
return "Second";
 
  132   if (TmZoneStr==
"A"){ 
return "+1000";}
 
  133   if (TmZoneStr==
"ACDT"){ 
return "+1030";}
 
  134   if (TmZoneStr==
"ACST"){ 
return "+0930";}
 
  135   if (TmZoneStr==
"ADT"){ 
return "-0300";}
 
  136   if (TmZoneStr==
"AEDT"){ 
return "+1100";}
 
  137   if (TmZoneStr==
"AEST"){ 
return "+1000";}
 
  138   if (TmZoneStr==
"AKDT"){ 
return "-0800";}
 
  139   if (TmZoneStr==
"AKST"){ 
return "-0900";}
 
  140   if (TmZoneStr==
"AST"){ 
return "-0400";}
 
  141   if (TmZoneStr==
"AWDT"){ 
return "+0900";}
 
  142   if (TmZoneStr==
"AWST"){ 
return "+0800";}
 
  143   if (TmZoneStr==
"B"){ 
return "+0200";}
 
  144   if (TmZoneStr==
"BST"){ 
return "+0100";}
 
  145   if (TmZoneStr==
"C"){ 
return "+0300";}
 
  146   if (TmZoneStr==
"CDT"){ 
return "-0500";}
 
  147   if (TmZoneStr==
"CDT"){ 
return "+1030";}
 
  148   if (TmZoneStr==
"CEDT"){ 
return "+0200";}
 
  149   if (TmZoneStr==
"CEST"){ 
return "+0200";}
 
  150   if (TmZoneStr==
"CET"){ 
return "+0100";}
 
  151   if (TmZoneStr==
"CST"){ 
return "-0600";}
 
  152   if (TmZoneStr==
"CST"){ 
return "+1030";}
 
  153   if (TmZoneStr==
"CST"){ 
return "+0930";}
 
  154   if (TmZoneStr==
"CXT"){ 
return "+0700";}
 
  155   if (TmZoneStr==
"D"){ 
return "+0400";}
 
  156   if (TmZoneStr==
"E"){ 
return "+0500";}
 
  157   if (TmZoneStr==
"EDT"){ 
return "-0400";}
 
  158   if (TmZoneStr==
"EDT"){ 
return "+1100";}
 
  159   if (TmZoneStr==
"EEDT"){ 
return "+0300";}
 
  160   if (TmZoneStr==
"EEST"){ 
return "+0300";}
 
  161   if (TmZoneStr==
"EET"){ 
return "+0200";}
 
  162   if (TmZoneStr==
"EST"){ 
return "-0500";}
 
  163   if (TmZoneStr==
"EST"){ 
return "+1100";}
 
  164   if (TmZoneStr==
"EST"){ 
return "+1000";}
 
  165   if (TmZoneStr==
"F"){ 
return "+0600";}
 
  166   if (TmZoneStr==
"G"){ 
return "+0700";}
 
  167   if (TmZoneStr==
"GMT"){ 
return "+0000";}
 
  168   if (TmZoneStr==
"H"){ 
return "+0800";}
 
  169   if (TmZoneStr==
"HAA"){ 
return "-0300";}
 
  170   if (TmZoneStr==
"HAC"){ 
return "-0500";}
 
  171   if (TmZoneStr==
"HADT"){ 
return "-0900";}
 
  172   if (TmZoneStr==
"HAE"){ 
return "-0400";}
 
  173   if (TmZoneStr==
"HAP"){ 
return "-0700";}
 
  174   if (TmZoneStr==
"HAR"){ 
return "-0600";}
 
  175   if (TmZoneStr==
"HAST"){ 
return "-1000";}
 
  176   if (TmZoneStr==
"HAT"){ 
return "-0230";}
 
  177   if (TmZoneStr==
"HAY"){ 
return "-0800";}
 
  178   if (TmZoneStr==
"HNA"){ 
return "-0400";}
 
  179   if (TmZoneStr==
"HNC"){ 
return "-0600";}
 
  180   if (TmZoneStr==
"HNE"){ 
return "-0500";}
 
  181   if (TmZoneStr==
"HNP"){ 
return "-0800";}
 
  182   if (TmZoneStr==
"HNR"){ 
return "-0700";}
 
  183   if (TmZoneStr==
"HNT"){ 
return "-0330";}
 
  184   if (TmZoneStr==
"HNY"){ 
return "-0900";}
 
  185   if (TmZoneStr==
"I"){ 
return "+0900";}
 
  186   if (TmZoneStr==
"IST"){ 
return "+0100";}
 
  187   if (TmZoneStr==
"K"){ 
return "+1000";}
 
  188   if (TmZoneStr==
"L"){ 
return "+1100";}
 
  189   if (TmZoneStr==
"M"){ 
return "+1200";}
 
  190   if (TmZoneStr==
"MDT"){ 
return "-0600";}
 
  191   if (TmZoneStr==
"MESZ"){ 
return "+0200";}
 
  192   if (TmZoneStr==
"MEZ"){ 
return "+0100";}
 
  193   if (TmZoneStr==
"MSD"){ 
return "+0400";}
 
  194   if (TmZoneStr==
"MSK"){ 
return "+0300";}
 
  195   if (TmZoneStr==
"MST"){ 
return "-0700";}
 
  196   if (TmZoneStr==
"N"){ 
return "-0100";}
 
  197   if (TmZoneStr==
"NDT"){ 
return "-0230";}
 
  198   if (TmZoneStr==
"NFT"){ 
return "+ 11:30";}
 
  199   if (TmZoneStr==
"NST"){ 
return "-0330";}
 
  200   if (TmZoneStr==
"O"){ 
return "-0200";}
 
  201   if (TmZoneStr==
"P"){ 
return "-0300";}
 
  202   if (TmZoneStr==
"PDT"){ 
return "-0700";}
 
  203   if (TmZoneStr==
"PST"){ 
return "-0800";}
 
  204   if (TmZoneStr==
"Q"){ 
return "-0400";}
 
  205   if (TmZoneStr==
"R"){ 
return "-0500";}
 
  206   if (TmZoneStr==
"S"){ 
return "-0600";}
 
  207   if (TmZoneStr==
"T"){ 
return "-0700";}
 
  208   if (TmZoneStr==
"U"){ 
return "-0800";}
 
  209   if (TmZoneStr==
"UTC"){ 
return "+0000";}
 
  210   if (TmZoneStr==
"V"){ 
return "-0900";}
 
  211   if (TmZoneStr==
"W"){ 
return "-1000";}
 
  212   if (TmZoneStr==
"WDT"){ 
return "+0900";}
 
  213   if (TmZoneStr==
"WEDT"){ 
return "+0100";}
 
  214   if (TmZoneStr==
"WEST"){ 
return "+0100";}
 
  215   if (TmZoneStr==
"WET"){ 
return "+0000";}
 
  216   if (TmZoneStr==
"WST"){ 
return "+0900";}
 
  217   if (TmZoneStr==
"WST"){ 
return "+0800";}
 
  218   if (TmZoneStr==
"X"){ 
return "-1100";}
 
  219   if (TmZoneStr==
"Y"){ 
return "-1200";}
 
  220   if (TmZoneStr==
"Z"){ 
return "+0000";}
 
  315     jdn = 367L * y - 7 * (y + 5001L + (m - 9) / 7) / 4
 
  316      + 275 * m / 9 + d + 1729777L;
 
  318     jdn = (long)(d - 32076)
 
  319      + 1461L * (y + 4800L + (m - 14) / 12) / 4
 
  320      + 367 * (m - 2 - (m - 14) / 12 * 12) / 12
 
  321      - 3 * ((y + 4900L + (m - 14) / 12) / 100) / 4
 
  331   long daysPer400Years = 146097L;
 
  332   long fudgedDaysPer4000Years = 1460970L + 31;
 
  340     daysPer400Years = 146100L;
 
  341     fudgedDaysPer4000Years = 1461000L + 1;
 
  343   z = 4 * x / daysPer400Years;
 
  344   x = x - (daysPer400Years * z + 3) / 4;
 
  345   y = 4000 * (x + 1) / fudgedDaysPer4000Years;
 
  346   x = x - 1461 * y / 4 + 31;
 
  348   d = x - 2447 * m / 80;
 
  351   y = 100 * (z - 49) + y + x;
 
  363 bool TSecTm::GetTmSec(
const int& YearN, 
const int& MonthN, 
const int& DayN, 
const int& HourN, 
const int& MinN, 
const int& SecN, 
uint& AbsSec) {
 
  372   Tm.tm_year=YearN-1900; Tm.tm_mon=MonthN-1; Tm.tm_mday=DayN;
 
  373   Tm.tm_hour=HourN; Tm.tm_min=MinN; Tm.tm_sec=SecN;
 
  374   Tm.tm_wday=1;  Tm.tm_yday=1;
 
  381   static const int m_to_d[12] = {0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334};
 
  385   year = t->tm_year + month / 12 + 1900;
 
  390   result = (year - 1970) * 365 + (year - 1969) / 4 + m_to_d[month];
 
  391   result = (year - 1970) * 365 + m_to_d[month];
 
  392   if (month <= 1) { year -= 1; }
 
  393   result += (year - 1968) / 4;
 
  394   result -= (year - 1900) / 100;
 
  395   result += (year - 1600) / 400;
 
  396   result += t->tm_mday;
 
  399   result += t->tm_hour;
 
  408   const time_t GmtTime = 
MkGmTime(&Tm);
 
  410     TStr::Fmt(
"Time out of range: %d/%d/%d %02d:%02d:%02d",
 
  411     Tm.tm_year, Tm.tm_mon, Tm.tm_mday, Tm.tm_hour, Tm.tm_min, Tm.tm_sec).
CStr());
 
  412   AbsSec = 
uint(GmtTime);
 
  417   const time_t TimeT = time_t(AbsSec);
 
  418   #if defined(GLib_MSC) 
  419   return _gmtime64_s(&Tm, &TimeT) == 0;
 
  420   #elif defined(GLib_BCB) 
  421   Tm=*gmtime(&TimeT); 
return true;
 
  423   return gmtime_r(&TimeT, &Tm) != NULL;
 
  428  const int& HourN, 
const int& MinN, 
const int& SecN) : AbsSecs(
TUInt::Mx){
 
  433  TSecTm(Tm.GetYear(), Tm.GetMonth(), Tm.GetDay(), Tm.GetHour(),
 
  434    Tm.GetMin(), Tm.GetSec()).GetAbsSecs()) { }
 
  443   AbsSecs = 
TSecTm(Year, Month, Day, Hour, Min, Sec).GetAbsSecs();
 
  462     return TStr::Fmt(
"%s %s %d %02d:%02d:%02d %d",
 
  465       Tm.tm_mday, Tm.tm_hour, Tm.tm_min, Tm.tm_sec, Tm.tm_year+1900);
 
  476   else if (TmUnit == 
tmuDay) {
 
  479     return TStr::Fmt(
"%04d-%02d-%02d %02d:%02d:%02d",
 
  499   return TStr::Fmt(
"%02d/%02d%/%04d", Tm.tm_mon+1, Tm.tm_mday, Tm.tm_year+1900);
 
  505   return TStr::Fmt(
"%04d-%02d-%02d", Tm.tm_year+1900, Tm.tm_mon+1, Tm.tm_mday);
 
  511   return TStr::Fmt(
"%04d-%02d-%02d %02d:%02d:%02d", Tm.tm_year+1900, Tm.tm_mon+1, Tm.tm_mday, Tm.tm_hour, Tm.tm_min, Tm.tm_sec);
 
  517   return TStr::Fmt(
"%04d-%02d-%02d-%02d:%02d:%02d", Tm.tm_year+1900, Tm.tm_mon+1, Tm.tm_mday, Tm.tm_hour, Tm.tm_min, Tm.tm_sec);
 
  524     return TStr::Fmt(
"%02d:%02d:%02d", Tm.tm_hour, Tm.tm_min, Tm.tm_sec);
 
  534     return TStr::Fmt(
"%02d:%02d", Tm.tm_min, Tm.tm_sec);
 
  563   return Tm.tm_year+1900;
 
  587   return Tm.tm_wday + 1;
 
  614 void TSecTm::GetComps(
int& Year, 
int& Month, 
int& Day, 
int& Hour, 
int& Min, 
int& Sec)
 const {
 
  617   Year = Tm.tm_year+1900;
 
  626   if (TmUnit == 
tmu1Sec) { 
return *
this; }
 
  630     case tmu1Min : 
return TSecTm(Time.tm_year+1900, Time.tm_mon+1, Time.tm_mday, Time.tm_hour, Time.tm_min, 0);
 
  631     case tmu10Min : 
return TSecTm(Time.tm_year+1900, Time.tm_mon+1, Time.tm_mday, Time.tm_hour, 10*(Time.tm_min/10), 0);
 
  632     case tmu15Min : 
return TSecTm(Time.tm_year+1900, Time.tm_mon+1, Time.tm_mday, Time.tm_hour, 15*(Time.tm_min/15), 0);
 
  633     case tmu30Min : 
return TSecTm(Time.tm_year+1900, Time.tm_mon+1, Time.tm_mday, Time.tm_hour, 30*(Time.tm_min/30), 0);
 
  634     case tmu1Hour : 
return TSecTm(Time.tm_year+1900, Time.tm_mon+1, Time.tm_mday, Time.tm_hour, 0, 0);
 
  635     case tmu2Hour : 
return TSecTm(Time.tm_year+1900, Time.tm_mon+1, Time.tm_mday, 2*(Time.tm_hour/2), 0, 0);
 
  636     case tmu4Hour : 
return TSecTm(Time.tm_year+1900, Time.tm_mon+1, Time.tm_mday, 4*(Time.tm_hour/4), 0, 0);
 
  637     case tmu6Hour : 
return TSecTm(Time.tm_year+1900, Time.tm_mon+1, Time.tm_mday, 6*(Time.tm_hour/6), 0, 0);
 
  638     case tmu12Hour : 
return TSecTm(Time.tm_year+1900, Time.tm_mon+1, Time.tm_mday, 12*(Time.tm_hour/12), 0, 0);
 
  639     case tmuDay : 
return TSecTm(Time.tm_year+1900, Time.tm_mon+1, Time.tm_mday, 0, 0, 0);
 
  640     case tmuMonth : 
return TSecTm(Time.tm_year+1900, Time.tm_mon+1, 1, 0, 0, 0);
 
  641     case tmuYear : 
return TSecTm(Time.tm_year+1900, 1, 1, 0, 0, 0);
 
  642     case tmuWeek : { 
int dd=1, mm=1, yy=1;
 
  656     case tmu1Min : 
return TSecTm(Time.tm_year+1900, Time.tm_mon+1, Time.tm_mday, Time.tm_hour, Time.tm_min, 0).GetAbsSecs()/60;
 
  657     case tmu10Min : 
return TSecTm(Time.tm_year+1900, Time.tm_mon+1, Time.tm_mday, Time.tm_hour, 10*(Time.tm_min/10), 0).GetAbsSecs()/(10*60);
 
  658     case tmu15Min : 
return TSecTm(Time.tm_year+1900, Time.tm_mon+1, Time.tm_mday, Time.tm_hour, 15*(Time.tm_min/15), 0).GetAbsSecs()/(15*60);
 
  659     case tmu30Min : 
return TSecTm(Time.tm_year+1900, Time.tm_mon+1, Time.tm_mday, Time.tm_hour, 30*(Time.tm_min/30), 0).GetAbsSecs()/(30*60);
 
  660     case tmu1Hour : 
return TSecTm(Time.tm_year+1900, Time.tm_mon+1, Time.tm_mday, Time.tm_hour, 0, 0).GetAbsSecs()/3600;
 
  661     case tmu2Hour : 
return TSecTm(Time.tm_year+1900, Time.tm_mon+1, Time.tm_mday, 2*(Time.tm_hour/2), 0, 0).GetAbsSecs()/(2*3600);
 
  662     case tmu4Hour : 
return TSecTm(Time.tm_year+1900, Time.tm_mon+1, Time.tm_mday, 4*(Time.tm_hour/4), 0, 0).GetAbsSecs()/(4*3600);
 
  663     case tmu6Hour : 
return TSecTm(Time.tm_year+1900, Time.tm_mon+1, Time.tm_mday, 6*(Time.tm_hour/6), 0, 0).GetAbsSecs()/(6*3600);
 
  664     case tmu12Hour : 
return TSecTm(Time.tm_year+1900, Time.tm_mon+1, Time.tm_mday, 12*(Time.tm_hour/12), 0, 0).GetAbsSecs()/(12*3600);
 
  667     case tmuMonth : 
return 12*(Time.tm_year-70)+Time.tm_mon+1;
 
  668     case tmuYear : 
return Time.tm_year+1900;
 
  676   if (0 <= Hour && Hour < 6) { 
return "Night"; }
 
  677   else if (6 <= Hour && Hour < 12) { 
return "Morning"; }
 
  678   else if (12 <= Hour && Hour < 18) { 
return "Afternoon"; }
 
  679   else if (18 <= Hour && Hour < 24) { 
return "Evening"; }
 
  685   const time_t Time1= time_t(SecTm1.
AbsSecs());
 
  686   const time_t Time2= time_t(SecTm2.
AbsSecs());
 
  687   return uint(difftime(Time2, Time1));
 
  698   const time_t TmSec = time(NULL);
 
  701   #if defined(GLib_MSN) 
  702   localtime_s(&LocTm, &TmSec);
 
  703   #elif defined(GLib_BCB) 
  704   LocTm = *localtime(&TmSec);
 
  706   LocTm = *localtime(&TmSec);
 
  713   int HmsStrLen=HmsStr.
Len();
 
  716   while ((ChN<HmsStrLen)&&(HmsStr[ChN]!=
':')){ChA+=HmsStr[ChN]; ChN++;}
 
  720   while ((ChN<HmsStrLen)&&(HmsStr[ChN]!=
':')){ChA+=HmsStr[ChN]; ChN++;}
 
  724   while (ChN<HmsStrLen){ChA+=HmsStr[ChN]; ChN++;}
 
  727   int HourN=HourStr.
GetInt();
 
  739   int MdyStrLen=MdyStr.
Len();
 
  742   while ((ChN<MdyStrLen)&&(MdyStr[ChN]!=
'/')){
 
  743     ChA+=MdyStr[ChN]; ChN++;}
 
  747   while ((ChN<MdyStrLen)&&(MdyStr[ChN]!=
'/')){
 
  748     ChA+=MdyStr[ChN]; ChN++;}
 
  752   while (ChN<MdyStrLen){
 
  753     ChA+=MdyStr[ChN]; ChN++;}
 
  756   int MonthN=MonthStr.
GetInt();
 
  758   int YearN=YearStr.
GetInt();
 
  760     if (YearN<70){YearN+=2000;} 
else {YearN+=1900;}}
 
  762   return GetDtTm(YearN, MonthN, DayN);
 
  767   int DmyStrLen=DmyStr.
Len();
 
  770   while ((ChN<DmyStrLen)&&(DmyStr[ChN]!=
'/')&&(DmyStr[ChN]!=
'-')){
 
  771     ChA+=DmyStr[ChN]; ChN++;}
 
  775   while ((ChN<DmyStrLen)&&(DmyStr[ChN]!=
'/')&&(DmyStr[ChN]!=
'-')){
 
  776     ChA+=DmyStr[ChN]; ChN++;}
 
  780   while (ChN<DmyStrLen){
 
  781     ChA+=DmyStr[ChN]; ChN++;}
 
  784   int DayN=DayStr.
GetInt(-1);
 
  785   int MonthN=MonthStr.
GetInt(-1);
 
  786   int YearN=YearStr.
GetInt(-1);
 
  789   if ((DayN==-1)||(MonthN==-1)||(YearN==-1)){
 
  793       if (YearN<70){YearN+=2000;} 
else {YearN+=1900;}}
 
  795     return GetDtTm(YearN, MonthN, DayN);
 
  801  const char& DateSepCh, 
const char& TimeSepCh){
 
  802   int MdyHmsPmStrLen=MdyHmsPmStr.
Len();
 
  805   while ((ChN<MdyHmsPmStrLen)&&(MdyHmsPmStr[ChN]!=DateSepCh)){
 
  806     ChA+=MdyHmsPmStr[ChN]; ChN++;}
 
  810   while ((ChN<MdyHmsPmStrLen)&&(MdyHmsPmStr[ChN]!=DateSepCh)){
 
  811     ChA+=MdyHmsPmStr[ChN]; ChN++;}
 
  815   while ((ChN<MdyHmsPmStrLen)&&(MdyHmsPmStr[ChN]!=
' ')){
 
  816     ChA+=MdyHmsPmStr[ChN]; ChN++;}
 
  820   while ((ChN<MdyHmsPmStrLen)&&(MdyHmsPmStr[ChN]!=TimeSepCh)){
 
  821     ChA+=MdyHmsPmStr[ChN]; ChN++;}
 
  825   while ((ChN<MdyHmsPmStrLen)&&(MdyHmsPmStr[ChN]!=TimeSepCh)){
 
  826     ChA+=MdyHmsPmStr[ChN]; ChN++;}
 
  830   while ((ChN<MdyHmsPmStrLen)&&(MdyHmsPmStr[ChN]!=
' ')){
 
  831     ChA+=MdyHmsPmStr[ChN]; ChN++;}
 
  835   while (ChN<MdyHmsPmStrLen){
 
  836     ChA+=MdyHmsPmStr[ChN]; ChN++;}
 
  839   int MonthN=MonthStr.
GetInt();
 
  841   int YearN=YearStr.
GetInt();
 
  842   int HourN; 
int MinN; 
int SecN;
 
  843   if (HourStr.
IsInt()){
 
  847     if (AmPmStr==
"AM"){} 
else if (AmPmStr==
"PM"){HourN+=12;} 
else {
Fail;}
 
  849     HourN=0; MinN=0; SecN=0;
 
  860  const char& DateSepCh, 
const char& TimeSepCh){
 
  861   int YmdHmsPmStrLen=YmdHmsPmStr.
Len();
 
  864   while ((ChN<YmdHmsPmStrLen)&&(YmdHmsPmStr[ChN]!=DateSepCh)){
 
  865     ChA+=YmdHmsPmStr[ChN]; ChN++;}
 
  869   while ((ChN<YmdHmsPmStrLen)&&(YmdHmsPmStr[ChN]!=DateSepCh)){
 
  870     ChA+=YmdHmsPmStr[ChN]; ChN++;}
 
  874   while ((ChN<YmdHmsPmStrLen)&&(YmdHmsPmStr[ChN]!=
' ')){
 
  875     ChA+=YmdHmsPmStr[ChN]; ChN++;}
 
  879   while ((ChN<YmdHmsPmStrLen)&&(YmdHmsPmStr[ChN]!=TimeSepCh)){
 
  880     ChA+=YmdHmsPmStr[ChN]; ChN++;}
 
  884   while ((ChN<YmdHmsPmStrLen)&&(YmdHmsPmStr[ChN]!=TimeSepCh)){
 
  885     ChA+=YmdHmsPmStr[ChN]; ChN++;}
 
  889   while (ChN<YmdHmsPmStrLen){
 
  890     ChA+=YmdHmsPmStr[ChN]; ChN++;}
 
  893   int MonthN=MonthStr.
GetInt();
 
  895   int YearN=YearStr.
GetInt();
 
  896   int HourN; 
int MinN; 
int SecN;
 
  897   if (HourStr.
IsInt()){
 
  902     HourN=0; MinN=0; SecN=0;
 
  916  const int& DayId, 
const int& HourId, 
const int& MinId, 
const int& SecId) {
 
  917   TChA Tmp = YmdHmsPmStr;
 
  920   for (
char *c = (
char *) Tmp.
CStr(); *c; c++) {
 
  927   const int Y = atoi(FldV[YearId]);
 
  928   const int M = atoi(FldV[MonId]);
 
  929   const int D = atoi(FldV[DayId]);
 
  930   const int H = atoi(FldV[HourId]);
 
  931   const int m = atoi(FldV[MinId]);
 
  932   const int S = atoi(FldV[SecId]);
 
  933   IAssert(Y>0 && M>0 && D>0 && M<13 && D<32);
 
  934   IAssert(H>=0 && H<24 && m>=0 && m<60 && S>=0 && S<60);
 
  935   return TSecTm(Y,M,D,H,m,S);
 
  987   if (FullP||((
Sec!=0)||(
MSec!=0))){
 
  989     if ((MSecP)&&(FullP||(
MSec!=0))){
 
 1010  const int& Mins, 
const int& Secs, 
const int& MSecs){
 
 1020  const int& Mins, 
const int& Secs, 
const int& MSecs){
 
 1025   TmMSecs-=(
uint64(MSecs));
 
 1030   return TSysTm::GetCurUniTm();
 
 1034   static TTm LastUniqueTm=TSysTm::GetCurUniTm();
 
 1035   TTm CurUniqueTm=TSysTm::GetCurUniTm();
 
 1036   if (CurUniqueTm<LastUniqueTm){CurUniqueTm=LastUniqueTm;}
 
 1037   if (CurUniqueTm==LastUniqueTm){CurUniqueTm.
AddTime(0, 0, 0, 1);}
 
 1038   LastUniqueTm=CurUniqueTm;
 
 1043   static uint64 LastMUniqueTmMSecs=TSysTm::GetCurUniMSecs();
 
 1045   Assert(UniqueSpaces>=1&&UniqueSpaceN>=0&&UniqueSpaceN<UniqueSpaces);
 
 1047   uint64 CurUniqueTmMSecs=TSysTm::GetCurUniMSecs();
 
 1048   if (CurUniqueTmMSecs<LastMUniqueTmMSecs){CurUniqueTmMSecs=LastMUniqueTmMSecs;}
 
 1050   CurUniqueTmMSecs-=CurUniqueTmMSecs%UniqueSpaces; CurUniqueTmMSecs+=UniqueSpaceN;
 
 1052   if (CurUniqueTmMSecs<=LastMUniqueTmMSecs){
 
 1053     CurUniqueTmMSecs+=UniqueSpaces;
 
 1056   LastMUniqueTmMSecs=CurUniqueTmMSecs;
 
 1061   return TSysTm::GetCurLocTm();
 
 1065   return TSysTm::GetCurUniMSecs();
 
 1069   return TSysTm::GetCurLocMSecs();
 
 1073   return TSysTm::GetMSecsFromTm(Tm);
 
 1077   return TSysTm::GetTmFromMSecs(MSecs);
 
 1081   return TSysTm::GetMSecsFromOsStart();
 
 1085   return TSysTm::GetPerfTimerFq();
 
 1089   return TSysTm::GetPerfTimerTicks();
 
 1093           int& Hours, 
int& Mins, 
int& Secs, 
int& MSecs) {
 
 1096         const uint64 DiffSecs = DiffMSecs / 1000;
 
 1097         const uint64 DiffMins = DiffSecs / 60;
 
 1098         const uint64 DiffHours = DiffMins / 60; 
 
 1100         MSecs = int(DiffMSecs % 1000);
 
 1101         Secs = int(DiffSecs % 60);
 
 1102         Mins = int(DiffMins % 60);
 
 1103         Hours = int(DiffHours % 24);
 
 1104         Days = int((
int)DiffHours / 24);
 
 1110   if (Tm1MSecs>Tm2MSecs){
 
 1111     return Tm1MSecs-Tm2MSecs;
 
 1113     return Tm2MSecs-Tm1MSecs;
 
 1118   return TSysTm::GetLocTmFromUniTm(Tm);
 
 1122   return TSysTm::GetUniTmFromLocTm(Tm);
 
 1126  const char TimeSepCh, 
const char MSecSepCh){
 
 1127   int TimeStrLen=TimeStr.
Len();
 
 1129   TChA ChA; 
int ChN=0;
 
 1130   while ((ChN<TimeStrLen)&&(TimeStr[ChN]!=TimeSepCh)){
 
 1131     ChA+=TimeStr[ChN]; ChN++;}
 
 1135   while ((ChN<TimeStrLen)&&(TimeStr[ChN]!=TimeSepCh)){
 
 1136     ChA+=TimeStr[ChN]; ChN++;}
 
 1140   while ((ChN<TimeStrLen)&&(TimeStr[ChN]!=MSecSepCh)){
 
 1141     ChA+=TimeStr[ChN]; ChN++;}
 
 1145   while (ChN<TimeStrLen){
 
 1146     ChA+=TimeStr[ChN]; ChN++;}
 
 1149   int HourN=HourStr.
GetInt(0);
 
 1150   int MinN=MinStr.
GetInt(0);
 
 1151   int SecN=SecStr.
GetInt(0);
 
 1152   int MSecN=MSecStr.
GetInt(0);
 
 1154   TTm Tm(-1, -1, -1, -1, HourN, MinN, SecN, MSecN);
 
 1160  const char DateSepCh, 
const char TimeSepCh, 
const char MSecSepCh,
 
 1161  const char DateTimeSepCh){
 
 1162   int DateTimeStrLen=DateTimeStr.
Len();
 
 1164   TChA ChA; 
int ChN=0;
 
 1165   while ((ChN<DateTimeStrLen)&&(DateTimeStr[ChN]!=DateSepCh)){
 
 1166     ChA+=DateTimeStr[ChN]; ChN++;}
 
 1170   while ((ChN<DateTimeStrLen)&&(DateTimeStr[ChN]!=DateSepCh)){
 
 1171     ChA+=DateTimeStr[ChN]; ChN++;}
 
 1175   while ((ChN<DateTimeStrLen)&&(DateTimeStr[ChN]!=DateTimeSepCh)){
 
 1176     ChA+=DateTimeStr[ChN]; ChN++;}
 
 1180   while ((ChN<DateTimeStrLen)&&(DateTimeStr[ChN]!=TimeSepCh)){
 
 1181     ChA+=DateTimeStr[ChN]; ChN++;}
 
 1185   while ((ChN<DateTimeStrLen)&&(DateTimeStr[ChN]!=TimeSepCh)){
 
 1186     ChA+=DateTimeStr[ChN]; ChN++;}
 
 1190   while ((ChN<DateTimeStrLen)&&(DateTimeStr[ChN]!=MSecSepCh)){
 
 1191     ChA+=DateTimeStr[ChN]; ChN++;}
 
 1195   while (ChN<DateTimeStrLen){
 
 1196     ChA+=DateTimeStr[ChN]; ChN++;}
 
 1199   int YearN=YearStr.
GetInt(-1);
 
 1200   int MonthN=MonthStr.
GetInt(-1);
 
 1201   int DayN=DayStr.
GetInt(-1);
 
 1202   int HourN=HourStr.
GetInt(0);
 
 1203   int MinN=MinStr.
GetInt(0);
 
 1204   int SecN=SecStr.
GetInt(0);
 
 1205   int MSecN=MSecStr.
GetInt(0);
 
 1208   if ((YearN!=-1)&&(MonthN!=-1)&&(DayN!=-1)){
 
 1209     Tm=
TTm(YearN, MonthN, DayN, -1, HourN, MinN, SecN, MSecN);
 
 1218   if (IdChA.
Len()==14){
 
 1222   for (
int ChN=0; ChN<IdChA.
Len(); ChN++){
 
 1225   int YearN=2000+(
TStr(IdChA[0])+
TStr(IdChA[1])).GetInt();
 
 1226   int MonthN=(
TStr(IdChA[2])+
TStr(IdChA[3])).GetInt();
 
 1227   int DayN=(
TStr(IdChA[4])+
TStr(IdChA[5])).GetInt();
 
 1228   int HourN=(
TStr(IdChA[6])+
TStr(IdChA[7])).GetInt();
 
 1229   int MinN=(
TStr(IdChA[8])+
TStr(IdChA[9])).GetInt();
 
 1230   int SecN=(
TStr(IdChA[10])+
TStr(IdChA[11])).GetInt();
 
 1231   int MSecN=(
TStr(IdChA[12])+
TStr(IdChA[13])+
TStr(IdChA[14])).GetInt();
 
 1232   TTm Tm=
TTm(YearN, MonthN, DayN, -1, HourN, MinN, SecN, MSecN);
 
 1237       const int& Day, 
const int& Hour, 
const int& Min, 
const int& Sec) {
 
 1261         if (DateTimeInt == 0) { 
return TTm(); }
 
 1266         if (DateTimeInt == 0) { 
return TSecTm(); }
 
 1267         return TSecTm(DateTimeInt);
 
 1294     return TimerH[TimerId].GetSec();
 
 1299         printf(
"-- %s --\n", ProfileNm.
CStr());
 
 1300     printf(
"Sum: (%.2f sec):\n", TimerSumSec);
 
 1307         if (TimerSumSec > 0.0) {
 
 1309             const double TimerPerc =  TimerSec / TimerSumSec * 100.0;
 
 1310             printf(
" %s: %.2fs [%.2f%%]\n", TimerNm.
CStr(), TimerSec, TimerPerc);
 
 1312             printf(
" %s: -\n", TimerNm.
CStr());
 
double GetTimerSec(const int &TimerId) const 
 
void GetComps(int &Year, int &Month, int &Day, int &Hour, int &Min, int &Sec) const 
 
TStr GetYmdTmStr2() const 
 
static TStrV SiDayOfWeekNmV
 
bool GetTimerIdFNext(int &TimerId) const 
 
static TStr GetSpaceStr(const int &Spaces)
 
static TSecTm GetDtTmFromStr(const TChA &YmdHmsPmStr, const int &YearId=0, const int &MonId=1, const int &DayId=2, const int &HourId=3, const int &MinId=4, const int &SecId=5)
 
static void GetCalendarDate(int jdn, int &dd, int &mm, int &yy)
 
TSecTm & AddDays(const int &Days)
 
static TSecTm GetDtTmFromYmdHmsStr(const TStr &YmdHmsPmStr, const char &DateSepCh='-', const char &TimeSepCh=':')
 
static uint64 GetCurLocMSecs()
 
static void InitDayOfWeekNmV()
 
bool IsInt(const bool &Check, const int &MnVal, const int &MxVal, int &Val) const 
 
static uint GetDateIntFromTm(const TTm &Tm)
 
void Ins(const int &BChN, const char *CStr)
 
double GetTimerSumSec() const 
 
static bool IsNum(const char &Ch)
 
static void GetDiff(const TTm &Tm1, const TTm &Tm2, int &Days, int &Hours, int &Mins, int &Secs, int &MSecs)
 
static int GetJulianDateN(int d, int m, int y)
 
static void InitMonthNmV()
 
TStr GetYMDDashStr() const 
 
static TTm GetUniTmFromLocTm(const TTm &Tm)
 
static TSecTm GetDtTmFromHmsStr(const TStr &HmsStr)
 
static int LastJulianDate
 
static int GetMx(const int &Int1, const int &Int2)
 
static uint64 GetCurUniMSecs()
 
int GetDayOfWeekN() const 
 
TSizeTy Len() const 
Returns the number of elements in the vector. 
 
TSecTm & AddMins(const int &Mins)
 
static int GetTmUnitSecs(const TTmUnit &TmUnit)
 
void PutInt(const TInt &Int)
 
PXmlTok GetXmlTok() const 
 
static uint GetDateTimeIntFromTm(const TTm &Tm)
 
uint GetInUnits(const TTmUnit &TmUnit) const 
 
void SaveTxt(TOLx &Lx) const 
 
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 uint64 GetDiffMSecs(const TTm &Tm1, const TTm &Tm2)
 
static TTm GetTmFromDateTimeInt(const uint &DateTimeInt)
 
static TTm GetTmFromWebLogDateTimeStr(const TStr &DateTimeStr, const char DateSepCh='-', const char TimeSepCh=':', const char MSecSepCh='.', const char DateTimeSepCh=' ')
 
TStr GetDtTmSortFNmStr() const 
 
static TSecTm GetDtTmFromDmyStr(const TStr &DmyStr)
 
static TSecTm GetSecTmFromDateTimeInt(const uint &DateTimeInt)
 
static TStr GetDayOfWeekNm(const int &DayOfWeekN, const TLoc &Loc=lUs)
 
static TSecTm GetDtTmFromMdyStr(const TStr &MdyStr)
 
int AddTimer(const TStr &TimerNm)
 
static uint GetYearIntFromTm(const TTm &Tm)
 
static bool GetTmSec(const int &YearN, const int &MonthN, const int &DayN, const int &HourN, const int &MinN, const int &SecN, uint &AbsSec)
 
static TTm GetTmFromIdStr(const TStr &IdStr)
 
void PrintReport(const TStr &ProfileNm="") const 
 
unsigned long long uint64
 
int GetTimerIdFFirst() const 
 
void AddArg(const TStr &ArgNm, const bool &ArgVal)
 
int GetIntArgVal(const TStr &ArgNm, const int &DfVal=0) const 
 
static uint GetMSecsFromOsStart()
 
static TStrV UsDayOfWeekNmV
 
static time_t MkGmTime(struct tm *t)
 
static uint64 GetPerfTimerTicks()
 
TStr GetDayOfWeekNm(const TLoc &Loc=lUs) const 
 
TSecTm & AddSecs(const int &Secs)
 
static TStr GetMonthNm(const int &MonthN, const TLoc &Loc=lUs)
 
static TSecTm GetZeroWeekTm()
 
static TSecTm GetDtTm(const int &YearN, const int &MonthN, const int &DayN)
 
int AddKey(const TKey &Key)
 
static TStr GetTmZoneDiffStr(const TStr &TmZoneStr)
 
static TSecTm LoadTxt(TILx &Lx)
 
TStr GetTimerNm(const int &TimerId) const 
 
static TStr GetTmUnitStr(const TTmUnit &TmUnit)
 
TStr GetDtTmSortStr() const 
 
static uint GetMonthIntFromTm(const TTm &Tm)
 
TStr GetMonthNm(const TLoc &Loc=lUs) const 
 
static TTm GetUniqueCurUniTm()
 
static TTm GetTmFromWebLogTimeStr(const TStr &TimeStr, const char TimeSepCh=':', const char MSecSepCh='.')
 
TStr GetStr(const TLoc &Loc=lUs) const 
 
static TStr Fmt(const char *FmtStr,...)
 
static int GetMonthN(const TStr &MonthNm, const TLoc &Loc=lUs)
 
TStr GetDtStr(const TLoc &Loc=lUs) const 
 
TSizeTy SearchForw(const TVal &Val, const TSizeTy &BValN=0) const 
Returns the position of an element with value Val. 
 
#define EAssertR(Cond, MsgStr)
 
void ResetTimer(const TStr &TimerNm)
 
TStr GetHMSTColonDotStr(const bool &FullP=false, const bool &MSecP=true) const 
 
static TTm GetTmFromMSecs(const uint64 &MSecs)
 
static uint GetDSecs(const TSecTm &SecTm1, const TSecTm &SecTm2)
 
THash< TStr, TTmStopWatch > TimerH
 
void AddTime(const int &Hours, const int &Mins=0, const int &Secs=0, const int &MSecs=0)
 
static TSecTm GetDtTmFromMdyHmsPmStr(const TStr &MdyHmsPmStr, const char &DateSepCh='/', const char &TimeSepCh=':')
 
static int GetDayOfWeekN(const TStr &DayOfWeekNm, const TLoc &Loc=lUs)
 
static uint64 GetPerfTimerFq()
 
TSizeTy Add()
Adds a new element at the end of the vector, after its current last element. 
 
TStr GetStr(const bool &MSecP=true) const 
 
TSecTm & AddHours(const int &Hours)
 
void SubTime(const int &Hours, const int &Mins=0, const int &Secs=0, const int &MSecs=0)
 
static uint64 GetMSecsFromTm(const TTm &Tm)
 
static TStr GetHmFromMins(const int &Mins)
 
static int LastJulianDateN
 
static TTm GetLocTmFromUniTm(const TTm &Tm)
 
TSecTm Round(const TTmUnit &TmUnit) const 
 
static bool GetTmStruct(const uint &AbsSec, struct tm &Tm)
 
static TSecTm GetZeroTm()