SNAP Library 2.1, User Reference  2013-09-25 10:47:25
SNAP, a general purpose, high performance system for analysis and manipulation of large networks
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
TTmInfo Class Reference

#include <tm.h>

List of all members.

Static Public Member Functions

static int GetMonthN (const TStr &MonthNm, const TLoc &Loc=lUs)
static bool IsMonthNm (const TStr &MonthNm, const TLoc &Loc=lUs)
static TStr GetMonthNm (const int &MonthN, const TLoc &Loc=lUs)
static int GetDayOfWeekN (const TStr &DayOfWeekNm, const TLoc &Loc=lUs)
static bool IsDayOfWeekNm (const TStr &DayOfWeekNm, const TLoc &Loc=lUs)
static TStr GetDayOfWeekNm (const int &DayOfWeekN, const TLoc &Loc=lUs)
static TStr GetHmFromMins (const int &Mins)
static int GetTmUnitSecs (const TTmUnit &TmUnit)
static TStr GetTmUnitStr (const TTmUnit &TmUnit)
static TStr GetTmZoneDiffStr (const TStr &TmZoneStr)
static uint64 GetMinMSecs ()
static uint64 GetHourMSecs ()
static uint64 GetDayMSecs ()
static uint64 GetWeekMSecs ()

Static Public Attributes

static const int SunN = 1
static const int MonN = 2
static const int TueN = 3
static const int WedN = 4
static const int ThuN = 5
static const int FriN = 6
static const int SatN = 7
static const int JanN = 1
static const int FebN = 2
static const int MarN = 3
static const int AprN = 4
static const int MayN = 5
static const int JunN = 6
static const int JulN = 7
static const int AugN = 8
static const int SepN = 9
static const int OctN = 10
static const int NovN = 11
static const int DecN = 12

Static Private Member Functions

static void InitMonthNmV ()
static void InitDayOfWeekNmV ()
static void EnsureInit ()

Static Private Attributes

static bool InitP = false
static TStrV UsMonthNmV
static TStrV SiMonthNmV
static TStrV UsDayOfWeekNmV
static TStrV SiDayOfWeekNmV

Detailed Description

Definition at line 21 of file tm.h.


Member Function Documentation

static void TTmInfo::EnsureInit ( ) [inline, static, private]

Definition at line 30 of file tm.h.

                          {
    if (!InitP){InitMonthNmV(); InitDayOfWeekNmV(); InitP=true;}}
static uint64 TTmInfo::GetDayMSecs ( ) [inline, static]

Definition at line 63 of file tm.h.

{return 24*60*60*1000;}
int TTmInfo::GetDayOfWeekN ( const TStr DayOfWeekNm,
const TLoc Loc = lUs 
) [static]

Definition at line 60 of file tm.cpp.

                                                                  {
  EnsureInit();
  int DayOfWeekN=-1;
  switch (Loc){
    case lUs: DayOfWeekN=UsDayOfWeekNmV.SearchForw(DayOfWeekNm.GetLc()); break;
    case lSi: DayOfWeekN=SiDayOfWeekNmV.SearchForw(DayOfWeekNm.GetLc()); break;
    default: Fail;
  }
  if (DayOfWeekN==-1){return -1;} else {return DayOfWeekN+1;}
}
TStr TTmInfo::GetDayOfWeekNm ( const int &  DayOfWeekN,
const TLoc Loc = lUs 
) [static]

Definition at line 71 of file tm.cpp.

                                                                  {
  EnsureInit();
  IAssert((1<=DayOfWeekN)&&(DayOfWeekN<=7));
  switch (Loc){
    case lUs: return UsDayOfWeekNmV[DayOfWeekN-1];
    case lSi: return SiDayOfWeekNmV[DayOfWeekN-1];
    default: Fail; return TStr();
  }
}
TStr TTmInfo::GetHmFromMins ( const int &  Mins) [static]

Definition at line 81 of file tm.cpp.

                                          {
  return TInt::GetStr(Mins/60, "%02d")+":"+TInt::GetStr(Mins%60, "%02d");
}
static uint64 TTmInfo::GetHourMSecs ( ) [inline, static]

Definition at line 62 of file tm.h.

{return 60*60*1000;}
static uint64 TTmInfo::GetMinMSecs ( ) [inline, static]

Definition at line 61 of file tm.h.

{return 60*1000;}
int TTmInfo::GetMonthN ( const TStr MonthNm,
const TLoc Loc = lUs 
) [static]

Definition at line 39 of file tm.cpp.

                                                          {
  EnsureInit();
  int MonthN=-1;
  switch (Loc){
    case lUs: MonthN=UsMonthNmV.SearchForw(MonthNm.GetLc()); break;
    case lSi: MonthN=SiMonthNmV.SearchForw(MonthNm.GetLc()); break;
    default: Fail;
  }
  if (MonthN==-1){return -1;} else {return MonthN+1;}
}
TStr TTmInfo::GetMonthNm ( const int &  MonthN,
const TLoc Loc = lUs 
) [static]

Definition at line 50 of file tm.cpp.

                                                          {
  EnsureInit();
  IAssert((1<=MonthN)&&(MonthN<=12));
  switch (Loc){
    case lUs: return UsMonthNmV[MonthN-1];
    case lSi: return SiMonthNmV[MonthN-1];
    default: Fail; return TStr();
  }
}
int TTmInfo::GetTmUnitSecs ( const TTmUnit TmUnit) [static]

Definition at line 85 of file tm.cpp.

                                                {
  switch(TmUnit) {
    case tmuYear : return 365*24*3600;
    case tmuMonth : return 31*24*3600;
    case tmuWeek : return 7*24*3600;
    case tmuDay : return 24*3600;
    case tmu12Hour : return 12*3600;
    case tmu6Hour : return 6*3600;
    case tmu4Hour : return 4*3600;
    case tmu2Hour : return 2*3600;
    case tmu1Hour : return 1*3600;
    case tmu30Min : return 30*60;
    case tmu15Min : return 15*60;
    case tmu10Min : return 10*60;
    case tmu1Min : return 60;
    case tmu1Sec : return 1;
    case tmuNodes : Fail;
    case tmuEdges : Fail;
    default: Fail;
  }
  return -1;
}
TStr TTmInfo::GetTmUnitStr ( const TTmUnit TmUnit) [static]

Definition at line 108 of file tm.cpp.

                                                {
  switch(TmUnit) {
    case tmuYear : return "Year";
    case tmuMonth : return "Month";
    case tmuWeek : return "Week";
    case tmuDay : return "Day";
    case tmu12Hour : return "12 Hours";
    case tmu6Hour : return "6 Hours";
    case tmu4Hour : return "4 Hours";
    case tmu2Hour : return "2 Hours";
    case tmu1Hour : return "1 Hour";
    case tmu30Min : return "30 Minutes";
    case tmu15Min : return "15 Minutes";
    case tmu10Min : return "10 Minutes";
    case tmu1Min : return "Minute";
    case tmu1Sec : return "Second";
    case tmuNodes : return "Nodes";
    case tmuEdges : return "Edges";
    default: Fail;
  }
  return TStr::GetNullStr();
}
TStr TTmInfo::GetTmZoneDiffStr ( const TStr TmZoneStr) [static]

Definition at line 131 of file tm.cpp.

                                                   {
  if (TmZoneStr=="A"){/* Alpha Time Zone Military*/ return "+1000";}
  if (TmZoneStr=="ACDT"){/* Australian Central Daylight Time    Australia */ return "+1030";}
  if (TmZoneStr=="ACST"){/* Australian Central Standard Time    Australia */ return "+0930";}
  if (TmZoneStr=="ADT"){/* Atlantic Daylight Time       North America */ return "-0300";}
  if (TmZoneStr=="AEDT"){/* Australian Eastern Daylight Time or Australian Eastern Summer Time  Australia */ return "+1100";}
  if (TmZoneStr=="AEST"){/* Australian Eastern Standard Time    Australia */ return "+1000";}
  if (TmZoneStr=="AKDT"){/* Alaska Daylight Time        North America */ return "-0800";}
  if (TmZoneStr=="AKST"){/* Alaska Standard Time        North America */ return "-0900";}
  if (TmZoneStr=="AST"){/* Atlantic Standard Time       North America */ return "-0400";}
  if (TmZoneStr=="AWDT"){/* Australian Western Daylight Time    Australia */ return "+0900";}
  if (TmZoneStr=="AWST"){/* Australian Western Standard Time    Australia */ return "+0800";}
  if (TmZoneStr=="B"){/* Bravo Time Zone        Military */ return "+0200";}
  if (TmZoneStr=="BST"){/* British Summer Time  Europe */ return "+0100";}
  if (TmZoneStr=="C"){/* Charlie Time Zone      Military */ return "+0300";}
  if (TmZoneStr=="CDT"){/* Central Daylight Time        North America */ return "-0500";}
  if (TmZoneStr=="CDT"){/* Central Daylight Time        Australia */ return "+1030";}
  if (TmZoneStr=="CEDT"){/* Central European Daylight Time      Europe */ return "+0200";}
  if (TmZoneStr=="CEST"){/* Central European Summer Time        Europe */ return "+0200";}
  if (TmZoneStr=="CET"){/* Central European Time        Europe */ return "+0100";}
  if (TmZoneStr=="CST"){/* Central Standard Time        North America */ return "-0600";}
  if (TmZoneStr=="CST"){/* Central Summer Time  Australia */ return "+1030";}
  if (TmZoneStr=="CST"){/* Central Standard Time        Australia */ return "+0930";}
  if (TmZoneStr=="CXT"){/* Christmas Island Time        Australia */ return "+0700";}
  if (TmZoneStr=="D"){/* Delta Time Zone        Military */ return "+0400";}
  if (TmZoneStr=="E"){/* Echo Time Zone Military */ return "+0500";}
  if (TmZoneStr=="EDT"){/* Eastern Daylight Time        North America */ return "-0400";}
  if (TmZoneStr=="EDT"){/* Eastern Daylight Time        Australia */ return "+1100";}
  if (TmZoneStr=="EEDT"){/* Eastern European Daylight Time      Europe */ return "+0300";}
  if (TmZoneStr=="EEST"){/* Eastern European Summer Time        Europe */ return "+0300";}
  if (TmZoneStr=="EET"){/* Eastern European Time        Europe */ return "+0200";}
  if (TmZoneStr=="EST"){/* Eastern Standard Time        North America */ return "-0500";}
  if (TmZoneStr=="EST"){/* Eastern Summer Time  Australia */ return "+1100";}
  if (TmZoneStr=="EST"){/* Eastern Standard Time        Australia */ return "+1000";}
  if (TmZoneStr=="F"){/* Foxtrot Time Zone      Military */ return "+0600";}
  if (TmZoneStr=="G"){/* Golf Time Zone Military */ return "+0700";}
  if (TmZoneStr=="GMT"){/* Greenwich Mean Time  Europe */ return "+0000";}
  if (TmZoneStr=="H"){/* Hotel Time Zone        Military */ return "+0800";}
  if (TmZoneStr=="HAA"){/* Heure Avancee de l'Atlantique        North America */ return "-0300";}
  if (TmZoneStr=="HAC"){/* Heure Avancee du Centre      North America */ return "-0500";}
  if (TmZoneStr=="HADT"){/* Hawaii-Aleutian Daylight Time       North America */ return "-0900";}
  if (TmZoneStr=="HAE"){/* Heure Avancee de l'Est       North America */ return "-0400";}
  if (TmZoneStr=="HAP"){/* Heure Avancee du Pacifique   North America */ return "-0700";}
  if (TmZoneStr=="HAR"){/* Heure Avancee des Rocheuses  North America */ return "-0600";}
  if (TmZoneStr=="HAST"){/* Hawaii-Aleutian Standard Time       North America */ return "-1000";}
  if (TmZoneStr=="HAT"){/* Heure Avancee de Terre-Neuve North America */ return "-0230";}
  if (TmZoneStr=="HAY"){/* Heure Avancee du Yukon       North America */ return "-0800";}
  if (TmZoneStr=="HNA"){/* Heure Normale de l'Atlantique        North America */ return "-0400";}
  if (TmZoneStr=="HNC"){/* Heure Normale du Centre      North America */ return "-0600";}
  if (TmZoneStr=="HNE"){/* Heure Normale de l'Est       North America */ return "-0500";}
  if (TmZoneStr=="HNP"){/* Heure Normale du Pacifique   North America */ return "-0800";}
  if (TmZoneStr=="HNR"){/* Heure Normale des Rocheuses  North America */ return "-0700";}
  if (TmZoneStr=="HNT"){/* Heure Normale de Terre-Neuve North America */ return "-0330";}
  if (TmZoneStr=="HNY"){/* Heure Normale du Yukon       North America */ return "-0900";}
  if (TmZoneStr=="I"){/* India Time Zone        Military */ return "+0900";}
  if (TmZoneStr=="IST"){/* Irish Summer Time    Europe */ return "+0100";}
  if (TmZoneStr=="K"){/* Kilo Time Zone Military */ return "+1000";}
  if (TmZoneStr=="L"){/* Lima Time Zone Military */ return "+1100";}
  if (TmZoneStr=="M"){/* Mike Time Zone Military */ return "+1200";}
  if (TmZoneStr=="MDT"){/* Mountain Daylight Time       North America */ return "-0600";}
  if (TmZoneStr=="MESZ"){/* Mitteleuropeische Sommerzeit        Europe */ return "+0200";}
  if (TmZoneStr=="MEZ"){/* Mitteleuropeische Zeit       Europe */ return "+0100";}
  if (TmZoneStr=="MSD"){/* Moscow Daylight Time Europe */ return "+0400";}
  if (TmZoneStr=="MSK"){/* Moscow Standard Time Europe */ return "+0300";}
  if (TmZoneStr=="MST"){/* Mountain Standard Time       North America */ return "-0700";}
  if (TmZoneStr=="N"){/* November Time Zone     Military */ return "-0100";}
  if (TmZoneStr=="NDT"){/* Newfoundland Daylight Time   North America */ return "-0230";}
  if (TmZoneStr=="NFT"){/* Norfolk (Island) Time        Australia */ return "+ 11:30";}
  if (TmZoneStr=="NST"){/* Newfoundland Standard Time   North America */ return "-0330";}
  if (TmZoneStr=="O"){/* Oscar Time Zone        Military */ return "-0200";}
  if (TmZoneStr=="P"){/* Papa Time Zone Military */ return "-0300";}
  if (TmZoneStr=="PDT"){/* Pacific Daylight Time        North America */ return "-0700";}
  if (TmZoneStr=="PST"){/* Pacific Standard Time        North America */ return "-0800";}
  if (TmZoneStr=="Q"){/* Quebec Time Zone       Military */ return "-0400";}
  if (TmZoneStr=="R"){/* Romeo Time Zone        Military */ return "-0500";}
  if (TmZoneStr=="S"){/* Sierra Time Zone       Military */ return "-0600";}
  if (TmZoneStr=="T"){/* Tango Time Zone        Military */ return "-0700";}
  if (TmZoneStr=="U"){/* Uniform Time Zone      Military */ return "-0800";}
  if (TmZoneStr=="UTC"){/* Coordinated Universal Time Europe */ return "+0000";}
  if (TmZoneStr=="V"){/* Victor Time Zone       Military */ return "-0900";}
  if (TmZoneStr=="W"){/* Whiskey Time Zone      Military */ return "-1000";}
  if (TmZoneStr=="WDT"){/* Western Daylight Time        Australia */ return "+0900";}
  if (TmZoneStr=="WEDT"){/* Western European Daylight Time      Europe */ return "+0100";}
  if (TmZoneStr=="WEST"){/* Western European Summer Time        Europe */ return "+0100";}
  if (TmZoneStr=="WET"){/* Western European Time        Europe */ return "+0000";}
  if (TmZoneStr=="WST"){/* Western Summer Time  Australia */ return "+0900";}
  if (TmZoneStr=="WST"){/* Western Standard Time        Australia */ return "+0800";}
  if (TmZoneStr=="X"){/* X-ray Time Zone        Military */ return "-1100";}
  if (TmZoneStr=="Y"){/* Yankee Time Zone       Military */ return "-1200";}
  if (TmZoneStr=="Z"){/* Zulu Time Zone Military */ return "+0000";}
  return "-0000";
}
static uint64 TTmInfo::GetWeekMSecs ( ) [inline, static]

Definition at line 64 of file tm.h.

{return 7*24*60*60*1000;}
void TTmInfo::InitDayOfWeekNmV ( ) [static, private]

Definition at line 24 of file tm.cpp.

void TTmInfo::InitMonthNmV ( ) [static, private]

Definition at line 9 of file tm.cpp.

                          {
  // english
  UsMonthNmV.Add("jan"); UsMonthNmV.Add("feb"); UsMonthNmV.Add("mar");
  UsMonthNmV.Add("apr"); UsMonthNmV.Add("may"); UsMonthNmV.Add("jun");
  UsMonthNmV.Add("jul"); UsMonthNmV.Add("aug"); UsMonthNmV.Add("sep");
  UsMonthNmV.Add("oct"); UsMonthNmV.Add("nov"); UsMonthNmV.Add("dec");
  IAssert(UsMonthNmV.Len()==12);
  // slovene
  SiMonthNmV.Add("jan"); SiMonthNmV.Add("feb"); SiMonthNmV.Add("mar");
  SiMonthNmV.Add("apr"); SiMonthNmV.Add("maj"); SiMonthNmV.Add("jun");
  SiMonthNmV.Add("jul"); SiMonthNmV.Add("aug"); SiMonthNmV.Add("sep");
  SiMonthNmV.Add("okt"); SiMonthNmV.Add("nov"); SiMonthNmV.Add("dec");
  IAssert(SiMonthNmV.Len()==12);
}
static bool TTmInfo::IsDayOfWeekNm ( const TStr DayOfWeekNm,
const TLoc Loc = lUs 
) [inline, static]

Definition at line 38 of file tm.h.

                                                                         {
    return GetDayOfWeekN(DayOfWeekNm, Loc)!=-1;}
static bool TTmInfo::IsMonthNm ( const TStr MonthNm,
const TLoc Loc = lUs 
) [inline, static]

Definition at line 34 of file tm.h.

                                                                 {
    return GetMonthN(MonthNm, Loc)!=-1;}

Member Data Documentation

const int TTmInfo::AprN = 4 [static]

Definition at line 54 of file tm.h.

const int TTmInfo::AugN = 8 [static]

Definition at line 56 of file tm.h.

const int TTmInfo::DecN = 12 [static]

Definition at line 58 of file tm.h.

const int TTmInfo::FebN = 2 [static]

Definition at line 53 of file tm.h.

const int TTmInfo::FriN = 6 [static]

Definition at line 49 of file tm.h.

bool TTmInfo::InitP = false [static, private]

Definition at line 23 of file tm.h.

const int TTmInfo::JanN = 1 [static]

Definition at line 53 of file tm.h.

const int TTmInfo::JulN = 7 [static]

Definition at line 56 of file tm.h.

const int TTmInfo::JunN = 6 [static]

Definition at line 55 of file tm.h.

const int TTmInfo::MarN = 3 [static]

Definition at line 54 of file tm.h.

const int TTmInfo::MayN = 5 [static]

Definition at line 55 of file tm.h.

const int TTmInfo::MonN = 2 [static]

Definition at line 47 of file tm.h.

const int TTmInfo::NovN = 11 [static]

Definition at line 58 of file tm.h.

const int TTmInfo::OctN = 10 [static]

Definition at line 57 of file tm.h.

const int TTmInfo::SatN = 7 [static]

Definition at line 50 of file tm.h.

const int TTmInfo::SepN = 9 [static]

Definition at line 57 of file tm.h.

TStrV TTmInfo::SiDayOfWeekNmV [static, private]

Definition at line 27 of file tm.h.

TStrV TTmInfo::SiMonthNmV [static, private]

Definition at line 25 of file tm.h.

const int TTmInfo::SunN = 1 [static]

Definition at line 47 of file tm.h.

const int TTmInfo::ThuN = 5 [static]

Definition at line 49 of file tm.h.

const int TTmInfo::TueN = 3 [static]

Definition at line 48 of file tm.h.

TStrV TTmInfo::UsDayOfWeekNmV [static, private]

Definition at line 26 of file tm.h.

TStrV TTmInfo::UsMonthNmV [static, private]

Definition at line 24 of file tm.h.

const int TTmInfo::WedN = 4 [static]

Definition at line 48 of file tm.h.


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