After a bit of struggle figured out how to do time. So dumb that somethign so simple is so hard.

master
Zed A. Shaw 5 months ago
parent 567ffec4ac
commit 75663bfa46
  1. 4
      PPP3/Makefile
  2. 25
      PPP3/goc.cpp

@ -1,5 +1,7 @@
all:
meson compile -C . 2>&1 | ../builddir/goc
build:
meson compile -C .
test:

@ -1,8 +1,10 @@
#include <iostream>
#include <fstream>
#include <fmt/core.h>
#include <regex>
#include <string>
#include <iterator>
#include <ctime>
using namespace std;
using namespace fmt;
@ -11,21 +13,26 @@ int main()
{
regex err_re("(.*?):([0-9]+):([0-9]+):\\s*(.*?):\\s*(.*)");
string line;
smatch err_match;
smatch err;
ofstream stats_out;
stats_out.open("stats.csv", ios::out | ios::app);
auto t = time(nullptr);
auto tm = *std::gmtime(&t);
while(getline(cin, line)) {
print("{}\n", line);
if(regex_match(line, err_match, err_re)) {
string file_name = err_match[1].str();
string line = err_match[2].str();
string col = err_match[3].str();
string type = err_match[4].str();
string message = err_match[5].str();
if(regex_match(line, err, err_re)) {
string file_name = err[1].str();
string line = err[2].str();
string col = err[3].str();
string type = err[4].str();
string message = err[5].str();
print("{},{},{},{},{}\n",
file_name, line, col, type, message);
stats_out << put_time(&tm, "%FT%TZ");
stats_out << format(",{},{},{},{},{}\n", file_name, line, col, type, message);
}
}
stats_out.close();
return 0;
}

Loading…
Cancel
Save