From 87e12a42dbc115bf7087f17d7f6bb2414ec920dd Mon Sep 17 00:00:00 2001 From: tastytea Date: Sat, 5 May 2018 05:47:13 +0200 Subject: [PATCH] replace own time_point-to-string function with call to Easy::strtime_utc() --- CMakeLists.txt | 2 +- README.md | 2 +- src/mastobotmon.cpp | 14 +------------- src/mastobotmon.hpp | 1 - 4 files changed, 3 insertions(+), 16 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 55ed2ee..250bb31 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,6 +1,6 @@ cmake_minimum_required (VERSION 3.7) project (mastobotmon - VERSION 0.3.10 + VERSION 0.3.11 LANGUAGES CXX) include(GNUInstallDirs) diff --git a/README.md b/README.md index b824076..2243e9c 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ * Tested OS: Linux * C++ compiler (tested: gcc 6.4, clang 5.0) * [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) ## Get sourcecode diff --git a/src/mastobotmon.cpp b/src/mastobotmon.cpp index 17ee4c2..2529e8e 100644 --- a/src/mastobotmon.cpp +++ b/src/mastobotmon.cpp @@ -42,18 +42,6 @@ using std::chrono::system_clock; 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> &mentions) { const string filepath = config["data_dir"].asString() + "/mentions_" + straccount + ".csv"; @@ -66,7 +54,7 @@ const bool write_mentions(const string &straccount, std::vector &mention : mentions) { 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().url() + '\n'; output = std::regex_replace(output, restrip, ""); diff --git a/src/mastobotmon.hpp b/src/mastobotmon.hpp index 209d0eb..6a1a855 100644 --- a/src/mastobotmon.hpp +++ b/src/mastobotmon.hpp @@ -50,7 +50,6 @@ const string get_access_token(const string &account); const bool add_account(); const bool write_config(); -const string get_universal_time(const system_clock::time_point &timepoint); const bool write_mentions(const string &straccount, std::vector> &mentions); const bool write_statistics(const string &straccount, Json::Value &account_json);