kopia lustrzana https://gitlab.com/tomaszg/geostat
Fix daylight saving problems
std::get_time doesn't set daylight saving time information, it causes various problems with std::mktime later on causing drifts of +/- 1hmaster
rodzic
c584c33e07
commit
ee0704c539
|
@ -184,6 +184,7 @@ Caches Okapi::get_caches(const std::set<std::string>& codes) const {
|
|||
std::tm tmp;
|
||||
std::stringstream ss(el.value()["date_created"].get<std::string>());
|
||||
ss >> std::get_time(&tmp, "%Y-%m-%dT%H:%M:%S+");
|
||||
tmp.tm_isdst = -1;
|
||||
c.set_date_hidden(tmp);
|
||||
|
||||
cc.push_back(c);
|
||||
|
@ -216,6 +217,7 @@ Caches Okapi::get_user_caches(const std::string& uuid, int count) const {
|
|||
std::stringstream ss(el.value()["date"].get<std::string>());
|
||||
// TODO need to take care of the time zone :/
|
||||
ss >> std::get_time(&date, "%Y-%m-%dT%H:%M:%S+");
|
||||
date.tm_isdst = -1;
|
||||
codes.insert(el.value()["cache_code"].get<std::string>());
|
||||
tmp_data[el.value()["cache_code"].get<std::string>()] = { date, el.value()["was_recommended"] };
|
||||
}
|
||||
|
@ -232,6 +234,7 @@ Caches Okapi::get_user_caches(const std::string& uuid, int count) const {
|
|||
if (el.value()["type"] == "Found it") {
|
||||
std::stringstream ss(el.value()["date"].get<std::string>());
|
||||
ss >> std::get_time(&date, "%Y-%m-%dT%H-%M-%S");
|
||||
date.tm_isdst = -1;
|
||||
codes.insert(el.value()["cache_code"].get<std::string>());
|
||||
tmp_data[el.value()["cache_code"].get<std::string>()] = { date, el.value()["was_recommended"] };
|
||||
}
|
||||
|
|
Ładowanie…
Reference in New Issue