GCC Code Coverage Report
Directory: src/ Exec Total Coverage
File: src/date.cpp Lines: 7 7 100.0 %
Date: 2020-03-21 00:01:17 Branches: 3 6 50.0 %

Line Branch Exec Source
1
#include "expresscpp/date.hpp"
2
3
#include <chrono>
4
#include <iomanip>
5
#include <sstream>
6
7
namespace expresscpp {
8
9
30319
std::string Date::getTime() {
10
30319
  const auto timestamp_ = std::chrono::system_clock::now();
11
30319
  const time_t now_time = std::chrono::system_clock::to_time_t(timestamp_);
12
30319
  const auto gmt_time = gmtime(&now_time);
13
60638
  std::stringstream ss;
14
30319
  ss << std::put_time(gmt_time, "%Y-%m-%d %H:%M:%S");
15
60638
  return ss.str();
16
}
17
18
}  // namespace expresscpp