Skip to content

Commit

Permalink
Use std::tm instead of plain C tm
Browse files Browse the repository at this point in the history
(cherry-picked from commit 36e83e6)
  • Loading branch information
Vultraz committed Oct 7, 2018
1 parent 16fdbc4 commit 64d1765
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions src/format_time_summary.cpp
Expand Up @@ -22,19 +22,19 @@ namespace utils {

std::string format_time_summary(std::time_t t) {
std::time_t curtime = std::time(nullptr);
const struct tm* timeptr = std::localtime(&curtime);
const std::tm* timeptr = std::localtime(&curtime);
if(timeptr == nullptr) {
return "";
}

const struct tm current_time = *timeptr;
const std::tm current_time = *timeptr;

timeptr = std::localtime(&t);
if(timeptr == nullptr) {
return "";
}

const struct tm save_time = *timeptr;
const std::tm save_time = *timeptr;

std::string format_string;

Expand Down
2 changes: 1 addition & 1 deletion src/gui/dialogs/debug_clock.cpp
Expand Up @@ -175,7 +175,7 @@ debug_clock::time::time() : hour(0), minute(0), second(0), millisecond(0)
void debug_clock::time::set_current_time()
{
std::time_t now = ::std::time(nullptr);
tm* stamp = std::localtime(&now);
std::tm* stamp = std::localtime(&now);

hour = stamp->tm_hour;
minute = stamp->tm_min;
Expand Down
2 changes: 1 addition & 1 deletion src/save_index.cpp
Expand Up @@ -213,7 +213,7 @@ const config& save_info::summary() const

std::string save_info::format_time_local() const
{
if(tm* tm_l = std::localtime(&modified())) {
if(std::tm* tm_l = std::localtime(&modified())) {
const std::string format = preferences::use_twelve_hour_clock_format()
? _("%a %b %d %I:%M %p %Y")
: _("%a %b %d %H:%M %Y");
Expand Down
2 changes: 1 addition & 1 deletion src/server/ban.cpp
Expand Up @@ -329,7 +329,7 @@ static lg::log_domain log_server("server");
if (!time) return false;

if (duration.substr(0,4) == "TIME") {
struct tm* loc;
std::tm* loc;
loc = std::localtime(time);

std::size_t number = 0;
Expand Down

0 comments on commit 64d1765

Please sign in to comment.