replace own time_point-to-string function with call to Easy::strtime_utc()
This commit is contained in:
parent
869902b4bd
commit
87e12a42db
|
@ -1,6 +1,6 @@
|
||||||
cmake_minimum_required (VERSION 3.7)
|
cmake_minimum_required (VERSION 3.7)
|
||||||
project (mastobotmon
|
project (mastobotmon
|
||||||
VERSION 0.3.10
|
VERSION 0.3.11
|
||||||
LANGUAGES CXX)
|
LANGUAGES CXX)
|
||||||
|
|
||||||
include(GNUInstallDirs)
|
include(GNUInstallDirs)
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
* Tested OS: Linux
|
* Tested OS: Linux
|
||||||
* C++ compiler (tested: gcc 6.4, clang 5.0)
|
* C++ compiler (tested: gcc 6.4, clang 5.0)
|
||||||
* [cmake](https://cmake.org/) (tested: 3.9.6)
|
* [cmake](https://cmake.org/) (tested: 3.9.6)
|
||||||
* [mastodon-cpp](https://github.com/tastytea/mastodon-cpp) (at least: 0.10.1)
|
* [mastodon-cpp](https://github.com/tastytea/mastodon-cpp) (at least: 0.11.0)
|
||||||
* [jsoncpp](https://github.com/open-source-parsers/jsoncpp) (tested: 1.8.1)
|
* [jsoncpp](https://github.com/open-source-parsers/jsoncpp) (tested: 1.8.1)
|
||||||
|
|
||||||
## Get sourcecode
|
## Get sourcecode
|
||||||
|
|
|
@ -42,18 +42,6 @@ using std::chrono::system_clock;
|
||||||
|
|
||||||
Json::Value config; // Declared in mastobotmon.hpp
|
Json::Value config; // Declared in mastobotmon.hpp
|
||||||
|
|
||||||
// Transform time_point into a string with the universal time
|
|
||||||
const string get_universal_time(const system_clock::time_point &timepoint)
|
|
||||||
{
|
|
||||||
std::time_t time = system_clock::to_time_t(timepoint);
|
|
||||||
std::tm *timeinfo = std::gmtime(&time);
|
|
||||||
char buffer[9];
|
|
||||||
|
|
||||||
std::strftime(buffer, 9, "%T", timeinfo);
|
|
||||||
|
|
||||||
return buffer;
|
|
||||||
}
|
|
||||||
|
|
||||||
const bool write_mentions(const string &straccount, std::vector<std::shared_ptr<Easy::Notification>> &mentions)
|
const bool write_mentions(const string &straccount, std::vector<std::shared_ptr<Easy::Notification>> &mentions)
|
||||||
{
|
{
|
||||||
const string filepath = config["data_dir"].asString() + "/mentions_" + straccount + ".csv";
|
const string filepath = config["data_dir"].asString() + "/mentions_" + straccount + ".csv";
|
||||||
|
@ -66,7 +54,7 @@ const bool write_mentions(const string &straccount, std::vector<std::shared_ptr<
|
||||||
for (std::shared_ptr<Easy::Notification> &mention : mentions)
|
for (std::shared_ptr<Easy::Notification> &mention : mentions)
|
||||||
{
|
{
|
||||||
output = mention->status().account().acct() + ';';
|
output = mention->status().account().acct() + ';';
|
||||||
output += get_universal_time(mention->status().created_at()) + ';';
|
output += Easy::strtime_utc(mention->status().created_at(), "%T") + ';';
|
||||||
output += mention->status().content() + ';';
|
output += mention->status().content() + ';';
|
||||||
output += mention->status().url() + '\n';
|
output += mention->status().url() + '\n';
|
||||||
output = std::regex_replace(output, restrip, "");
|
output = std::regex_replace(output, restrip, "");
|
||||||
|
|
|
@ -50,7 +50,6 @@ const string get_access_token(const string &account);
|
||||||
const bool add_account();
|
const bool add_account();
|
||||||
const bool write_config();
|
const bool write_config();
|
||||||
|
|
||||||
const string get_universal_time(const system_clock::time_point &timepoint);
|
|
||||||
const bool write_mentions(const string &straccount,
|
const bool write_mentions(const string &straccount,
|
||||||
std::vector<std::shared_ptr<Mastodon::Easy::Notification>> &mentions);
|
std::vector<std::shared_ptr<Mastodon::Easy::Notification>> &mentions);
|
||||||
const bool write_statistics(const string &straccount, Json::Value &account_json);
|
const bool write_statistics(const string &straccount, Json::Value &account_json);
|
||||||
|
|
Loading…
Reference in New Issue