1
0
mirror of https://github.com/RPCS3/rpcs3.git synced 2024-11-23 03:02:53 +01:00
rpcs3/Utilities/date_time.h
Lassi Hämäläinen e9e87b8bd9 Add missing #includes to header files
- Multiple header files where missing #includes to other headers that
  where used in the header. Correct header was included in correct
  order in source files which caused everything to compile.
- Added missing #includes so header files correctly include all their
  dependencies and fixes problems with IDEs being unable to parse
  headers correctly due to missing symbols
2019-06-25 17:11:10 +03:00

36 lines
557 B
C++

#pragma once
#include <ctime>
#include <string>
namespace date_time
{
static inline tm get_time(time_t* _time)
{
tm buf;
time_t t = time(_time);
#ifdef _MSC_VER
localtime_s(&buf, &t);
#else
buf = *localtime(&t);
#endif
return buf;
}
static inline std::string current_time()
{
char str[80];
tm now = get_time(0);
strftime(str, sizeof(str), "%c", &now);
return str;
}
static inline std::string current_time_narrow()
{
char str[80];
tm now = get_time(0);
strftime(str, sizeof(str), "%Y%m%d%H%M%S", &now);
return str;
}
}