| 1004 | } |
| 1005 | |
| 1006 | void SetupEnvironment() { |
| 1007 | #ifndef WIN32 |
| 1008 | try { |
| 1009 | #if BOOST_FILESYSTEM_VERSION == 3 |
| 1010 | boost::filesystem::path::codecvt(); // Raises runtime error if current locale is invalid |
| 1011 | #else // boost filesystem v2 |
| 1012 | locale(); // Raises runtime error if current locale is invalid |
| 1013 | #endif |
| 1014 | } catch (runtime_error& e) { |
| 1015 | setenv("LC_ALL", "C", 1); // Force C locale |
| 1016 | } |
| 1017 | #endif |
| 1018 | } |
| 1019 | |
| 1020 | string DateTimeStrFormat(const char* pszFormat, int64_t nTime) { |
| 1021 | // locale takes ownership of the pointer |