Sunrise and sunset events
[wakeup.git] / test / log_retime.cpp
1 /*
2  *  Read a log file and change time time stamps to relative timestamps
3  *  from the beginning of the log.
4  */
5
6 #include <fstream>
7 #include <date.h>
8
9 int main(int argc, char *argv[])
10 {
11    std::ifstream logfile;
12    String        firstline, logline;
13    String        timefield;
14    UTC           firsttime, logtime;
15
16    logfile.open(argv[1]);
17
18    logfile >> firstline;
19    timefield = firstline(0,19);
20    firsttime = UTC(timefield);
21    logfile.seekg(0);
22
23    while (logfile >> logline)
24    {
25       String logfield;
26
27       timefield = logline(0,19);
28       logfield  = logline << 21;
29
30       logtime   = UTC(timefield);
31
32       std::cout << logtime - firsttime << " " << logfield << "\n";
33    }
34
35    return 0;
36 }