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 |