commit:     ea027318bda613cf3a552be2508daf1a14eab2a2
Author:     Mike Gilbert <floppym <AT> gentoo <DOT> org>
AuthorDate: Tue May 27 17:00:52 2025 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Tue Jun 24 01:06:46 2025 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=ea027318

emergelog: truncate fractional seconds

The ".0f" format will result in the timestamp being rounded to the
nearest second, which would give some messages a timestamp in the
future.

Truncating the fractional seconds gives behavior that is more
consistent.

Signed-off-by: Mike Gilbert <floppym <AT> gentoo.org>
Part-of: https://github.com/gentoo/portage/pull/1439
Signed-off-by: Sam James <sam <AT> gentoo.org>

 lib/_emerge/emergelog.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/_emerge/emergelog.py b/lib/_emerge/emergelog.py
index c3c42d8e63..30e27a8114 100644
--- a/lib/_emerge/emergelog.py
+++ b/lib/_emerge/emergelog.py
@@ -45,7 +45,7 @@ def emergelog(xterm_titles, mystr, short_msg=None):
             )
         mylock = portage.locks.lockfile(file_path)
         try:
-            mylogfile.write(f"{time.time():.0f}: {mystr}\n")
+            mylogfile.write(f"{int(time.time())}: {mystr}\n")
             mylogfile.close()
         finally:
             portage.locks.unlockfile(mylock)

Reply via email to