From: Davin McCall Date: Sat, 6 Jan 2018 22:23:35 +0000 (+0000) Subject: Allow decimal comma separator for times expressed as decimals. X-Git-Tag: v0.07~5 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=b2dd2289d31b3dadaf95aeabad852bfbbfca00f4;p=oweals%2Fdinit.git Allow decimal comma separator for times expressed as decimals. Some locales use a comma to separate a decimal whole from its fractional part, so allow either a decimal stop or a decimal comma. --- diff --git a/src/load_service.cc b/src/load_service.cc index 740ba76..5c211b1 100644 --- a/src/load_service.cc +++ b/src/load_service.cc @@ -307,6 +307,8 @@ static gid_t parse_gid_param(const std::string ¶m, const std::string &servic return grent->gr_gid; } +// Parse a time, specified as a decimal number of seconds (with optional fractional component after decimal +// point or decimal comma). static void parse_timespec(const std::string ¶mval, const std::string &servicename, const char * paramname, timespec &ts) { @@ -317,7 +319,7 @@ static void parse_timespec(const std::string ¶mval, const std::string &servi decltype(len) i; for (i = 0; i < len; i++) { char ch = paramval[i]; - if (ch == '.') { + if (ch == '.' || ch == ',') { i++; break; }