~singpolyma/biboumi

835c650ef5a7297cc8bd0d6e0799186e6a5d2126 — louiz’ 5 years ago 479b718
Actually, just use the C locale for the date formats

We don’t need any UTF-8 support here, and it’s more portable
2 files changed, 2 insertions(+), 2 deletions(-)

M CMakeLists.txt
M louloulibs/utils/time.cpp
M CMakeLists.txt => CMakeLists.txt +1 -1
@@ 332,7 332,7 @@ endif()
configure_file(unit/biboumi.service.cmake biboumi.service)

# Force the format of the date output
set(ENV{LANG} "C.UTF-8")
set(ENV{LANG} "C")
execute_process(COMMAND "date" "+%a %b %d %Y" OUTPUT_VARIABLE RPM_DATE
                OUTPUT_STRIP_TRAILING_WHITESPACE)
unset(ENV{LANG})

M louloulibs/utils/time.cpp => louloulibs/utils/time.cpp +1 -1
@@ 24,7 24,7 @@ std::time_t parse_datetime(const std::string& stamp)
  std::tm t = {};
#ifdef HAS_GET_TIME
  std::istringstream ss(stamp);
  ss.imbue(std::locale("C.UTF-8"));
  ss.imbue(std::locale("C"));

  std::string timezone;
  ss >> std::get_time(&t, format) >> timezone;