-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.cpp
31 lines (23 loc) · 942 Bytes
/
main.cpp
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
#include <iostream>
#include "enklave.hpp"
int main(int argc, char *argv[]) {
using namespace enklave;
std::string path_with_mails{enklave::config::path_with_mails};
if (argc > 1) // If path is passed in by first argument, override configured path.
path_with_mails = argv[1];
auto found_events = parse_directory(path_with_mails);
// Provide some user feedback:
std::cout << found_events.size() << " events were found:" << std::endl;
for (auto &x : found_events) {
std::cout << x;
}
if (found_events.size() < 2) {
std::cerr << "Scanned directory does not contain files with at least one check-in and one check-out."
<< std::endl;
return 0;
}
auto timeslots = compute_timeslots(found_events);
auto result = compute_duration(timeslots);
std::cout << "Time spent at enklave: " << date::format("%T", result) << std::endl;
return 0;
}