diff --git a/Lib/logging/__init__.py b/Lib/logging/__init__.py
index 19bd2bc20b250248321b15b21a90761db1fa9d0c..09810bdf0d0beafde60f9631ed3b7fc3b67fa490 100644
--- a/Lib/logging/__init__.py
+++ b/Lib/logging/__init__.py
@@ -325,7 +325,7 @@ def __init__(self, name, level, pathname, lineno,
         self.lineno = lineno
         self.funcName = func
         self.created = ct
-        self.msecs = (ct - int(ct)) * 1000
+        self.msecs = int((ct - int(ct)) * 1000) + 0.0  # see gh-89047
         self.relativeCreated = (self.created - _startTime) * 1000
         if logThreads:
             self.thread = threading.get_ident()
diff --git a/Lib/test/test_logging.py b/Lib/test/test_logging.py
index af68f2582040e6ddd9ee424d73da77c35f52041f..920bbeb66006a186612e65545b8713adfccd5fb6 100644
--- a/Lib/test/test_logging.py
+++ b/Lib/test/test_logging.py
@@ -4020,6 +4020,14 @@ class NoMsecFormatter(logging.Formatter):
         f.converter = time.gmtime
         self.assertEqual(f.formatTime(r), '21/04/1993 08:03:00')
 
+    def test_issue_89047(self):
+        f = logging.Formatter(fmt='{asctime}.{msecs:03.0f} {message}', style='{', datefmt="%Y-%m-%d %H:%M:%S")
+        for i in range(2500):
+            time.sleep(0.0004)
+            r = logging.makeLogRecord({'msg': 'Message %d' % (i + 1)})
+            s = f.format(r)
+            self.assertNotIn('.1000', s)
+
 
 class TestBufferingFormatter(logging.BufferingFormatter):
     def formatHeader(self, records):