Replaced raw array with std::array.

This commit is contained in:
tastytea 2019-09-23 22:53:11 +02:00
parent a414b998f0
commit 31de8ff620
Signed by: tastytea
GPG Key ID: CFC39497F1B26E07
1 changed files with 9 additions and 5 deletions

View File

@ -18,10 +18,13 @@
#include <iomanip>
#include <sstream>
#include <cstdint>
#include <array>
#include "time.hpp"
namespace remwharead
{
using std::array;
const time_point string_to_timepoint(const string &strtime, bool sqlite)
{
std::stringstream sstime(strtime);
@ -46,16 +49,17 @@ namespace remwharead
std::tm *tm;
tm = std::localtime(&time);
char buffer[bufsize];
array<char, bufsize> buffer = {};
if (sqlite)
{
std::strftime(buffer, bufsize, "%F %T", tm);
std::strftime(buffer.begin(), bufsize, "%F %T", tm);
}
else
{
std::strftime(buffer, bufsize, "%FT%T", tm);
std::strftime(buffer.begin(), bufsize, "%FT%T", tm);
}
return static_cast<const string>(buffer);
return buffer.begin();
}
}
} // namespace remwharead