-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLogMaker.cpp
More file actions
51 lines (35 loc) · 855 Bytes
/
LogMaker.cpp
File metadata and controls
51 lines (35 loc) · 855 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#include "LogMaker.h"
#define DATASIZE 6 // Date Array Size
using namespace std;
LogMaker::LogMaker(string filename)
{
this->filename=filename;
OpenLog(this->filename);
}
LogMaker::~LogMaker()
{
CloseLog();
}
void LogMaker::MakeLog(tm* time, int nFaces)
{
if (!file.is_open())
this->OpenLog(filename);
string timevec=this->UnwrapTime(time);
file << timevec << "," << nFaces << endl;
//cout << timevec << "," << nFaces << endl;
}
void LogMaker::OpenLog(string filename)
{
file.open(filename.c_str(),fstream::app|fstream::out);
}
void LogMaker::CloseLog()
{
file.close();
}
//desembrulha o tempo em um vetor [ano, mes, dia, etc...]
string LogMaker::UnwrapTime(tm* time)
{
char t[15];
strftime (t,15,"%Y%m%d%H%M%S",time); // yyyymmddhhmmss
return t;
}