diff --git a/doc/html/changelog.html b/doc/html/changelog.html
index ea4ee134..30013f4a 100644
--- a/doc/html/changelog.html
+++ b/doc/html/changelog.html
@@ -86,6 +86,7 @@
Added a new options --preserve-modtime and --no-preserve-modtime to specify whether or not output files should copy the timestamp and permissions from their input files. The default is --preserve-modtime as in previous versions. (SF #1805428).
The --sector-align option of flac has been deprecated and may not exist in future versions. shntool provides similar functionality. (SF #1805946)
Fix bug where flac was disallowing use of --replay-gain when encoding from stdin (SF #1840124).
+ Fix bug with fractional seconds on some locales (SF #1858012).
diff --git a/src/flac/utils.c b/src/flac/utils.c
index 625716dc..287f6285 100644
--- a/src/flac/utils.c
+++ b/src/flac/utils.c
@@ -55,7 +55,7 @@ static FLAC__bool local__parse_timecode_(const char *s, double *value)
{
double ret;
unsigned i;
- char c;
+ char c, *endptr;
/* parse [0-9][0-9]*: */
c = *s++;
@@ -74,12 +74,9 @@ static FLAC__bool local__parse_timecode_(const char *s, double *value)
/* parse [0-9]*[.,]?[0-9]* i.e. a sign-less rational number (. or , OK for fractional seconds, to support different locales) */
if(strspn(s, "1234567890.,") != strlen(s))
return false;
- {
- const char *p = strpbrk(s, ".,");
- if(p && 0 != strpbrk(++p, ".,"))
- return false;
- }
- ret += atof(s);
+ ret += strtod(s, &endptr);
+ if (endptr == s || *endptr)
+ return false;
*value = ret;
return true;