-
-
Save griwes/1f0395f251542feb3295 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
std::string _make_filename() const | |
{ | |
auto rounded_time_point = std::chrono::system_clock::time_point( | |
std::chrono::duration_cast<std::chrono::system_clock::duration>( | |
std::chrono::duration_cast<Duration>( | |
std::chrono::system_clock::now().time_since_epoch() | |
) | |
) | |
); | |
// fuck you, whoever decided that the below is the proper way to format time in C++11 | |
auto tt = std::chrono::system_clock::to_time_t(rounded_time_point); | |
// seriously, fuck you. you are the worst person to ever walk this planet. | |
// also fuck non-thread-safe localtime | |
// auto tm = *std::localtime(&tt); | |
// I even prefer stucking the goddamned #ifdefs here over trying to use you, you useless shit | |
std::tm tm; | |
#if defined(__unix__) | |
localtime_r(&tt, &tm); | |
#else | |
# error "your system is unsupported; please file a bug report or a pull request that fixes this" | |
#endif | |
// yes, you are the worst person to ever walk this planet, and I do remember Hitler used to do that | |
std::stringstream stream; | |
// put_time was added in C++11. WHY IS THERE NO SANE WAY TO OUTPUT A C++11 TYPE CALLED TIME_POINT?! | |
//stream << std::put_time(&tm, _filename_pattern); | |
return stream.str(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment