FACT++  1.0
string DataLogger::CompileFileNameWithPath ( const string &  path,
const string &  service,
const string &  extension 
)
private

Get the digits of year, month and day for filenames and paths.

Appends the relevant year month day to a given path Form the files path

Definition at line 851 of file datalogger.cc.

References Time::GetAsStr(), str, and time.

Referenced by EvalOptions(), GoToNightlyWriteErrorState(), GoToReady(), Report(), and Start().

852 {
853  ostringstream str;
854 
855  const Time time;
856 
857  //calculate time suitable for naming files.
858  //fCurrentDay is 30 minutes after upcoming sunrise. So just use 12 hours before then
859  const Time ftime = fCurrentDay-boost::posix_time::hours(12);
860 
861  //output it
862  str << path << ftime.GetAsStr("/%Y/%m/%d");
863 
864  //check if target directory exist
865  if (!DoesPathExist(str.str()))
866  CreateDirectory(str.str());
867 
868  str << '/' << CompileFileName(service, extension, ftime);//fCurrentDay);
869 
870  return str.str();
871 
872 
873 }
Adds some functionality to boost::posix_time::ptime for our needs.
Definition: Time.h:30
char str[80]
Definition: test_client.c:7
bool CreateDirectory(const string &path)
Create a given directory.
Definition: datalogger.cc:511
bool DoesPathExist(string path)
Checks if a given path exist.
Definition: datalogger.cc:530
Time fCurrentDay
Definition: datalogger.cc:397
Warning because the service this data corrsponds to might have been last updated longer ago than Local time
Definition: smartfact.txt:92
string CompileFileName(const string &service, const string &extension, const Time &time=Time()) const
Form the file names only.
Definition: datalogger.cc:835
std::string GetAsStr(const char *fmt="%Y-%m-%d %H:%M:%S") const
Definition: Time.cc:240

+ Here is the call graph for this function:

+ Here is the caller graph for this function: