Fix compilation problems with time structures on Linux

This commit is contained in:
David Capello 2015-03-04 19:42:48 -03:00
parent f0ab007144
commit e822ddba4c
2 changed files with 3 additions and 2 deletions

View File

@ -10,6 +10,7 @@
#include <stdlib.h>
#include <stdexcept>
#include <vector>
#include <ctime>
#if __APPLE__
#include <mach-o/dyld.h>
@ -90,7 +91,7 @@ Time get_modification_time(const std::string& path)
if (result != 0)
return Time();
struct tm* t = localtime(&sts.st_mtime);
std::tm* t = std::localtime(&sts.st_mtime);
return Time(
t->tm_year+1900, t->tm_mon+1, t->tm_mday,
t->tm_hour, t->tm_min, t->tm_sec);

View File

@ -29,7 +29,7 @@ Time current_time()
#else
std::time_t now = std::time(nullptr);
struct tm* t = std::time(nullptr);
std::tm* t = std::localtime(&now);
return Time(
t->tm_year+1900, t->tm_mon+1, t->tm_mday,
t->tm_hour, t->tm_min, t->tm_sec);