This commit is contained in:
parent
bb8d8fd5fe
commit
6d07f08607
|
@ -1,6 +1,6 @@
|
||||||
cmake_minimum_required (VERSION 3.2)
|
cmake_minimum_required (VERSION 3.2)
|
||||||
project(gitea2rss
|
project(gitea2rss
|
||||||
VERSION 0.3.0
|
VERSION 0.3.1
|
||||||
LANGUAGES CXX
|
LANGUAGES CXX
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
11
src/main.cpp
11
src/main.cpp
|
@ -90,10 +90,10 @@ const string strtime(const system_clock::time_point &timepoint)
|
||||||
{
|
{
|
||||||
constexpr uint16_t bufsize = 1024;
|
constexpr uint16_t bufsize = 1024;
|
||||||
std::time_t time = system_clock::to_time_t(timepoint);
|
std::time_t time = system_clock::to_time_t(timepoint);
|
||||||
std::tm *timeinfo;
|
std::tm *tm;
|
||||||
timeinfo = std::localtime(&time);
|
tm = std::gmtime(&time);
|
||||||
char buffer[bufsize];
|
char buffer[bufsize];
|
||||||
std::strftime(buffer, bufsize, "%a, %d %b %Y %T %z", timeinfo);
|
std::strftime(buffer, bufsize, "%a, %d %b %Y %T %z", tm);
|
||||||
return static_cast<const string>(buffer);
|
return static_cast<const string>(buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -101,9 +101,10 @@ const string strtime(const system_clock::time_point &timepoint)
|
||||||
const string strtime(const string &time)
|
const string strtime(const string &time)
|
||||||
{
|
{
|
||||||
std::tm tm = {};
|
std::tm tm = {};
|
||||||
|
tm.tm_isdst = -1; // Detect daylight saving time.
|
||||||
std::stringstream ss(time);
|
std::stringstream ss(time);
|
||||||
ss >> std::get_time(&tm, "%Y-%m-%dT%T%z");
|
ss >> std::get_time(&tm, "%Y-%m-%dT%T"); // Assume time is UTC.
|
||||||
return strtime(std::chrono::system_clock::from_time_t(std::mktime(&tm)));
|
return strtime(std::chrono::system_clock::from_time_t(timegm(&tm)));
|
||||||
}
|
}
|
||||||
|
|
||||||
void write_line(const uint8_t spaces, const string &tag, const string &value)
|
void write_line(const uint8_t spaces, const string &tag, const string &value)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user