Skip to contentSkip to conversation

xfs_scrub_all: Replace deprecated datetime.utcnow

PATCH New Bastian Germann 1 participant 1 message Aug 31, 2025

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 xfs_scrub_all: Replace deprecated datetime.utcnow

Python 3.12 has deprecated datetime.datetime.utcnow. Replace it with datetime.datetime.now with timezone object.

Closes #1112588
---
 scrub/xfs_scrub_all.py.in | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
scrub/xfs_scrub_all.py.in +1 -2
index 515cc144..a94b1b71 100644
@@ -496,8 +496,7 @@ def scan_interval(string):
 def utcnow():
 	'''Create a representation of the time right now, in UTC.'''
 
-	dt = datetime.utcnow()
-	return dt.replace(tzinfo = timezone.utc)
+	return datetime.now(timezone.utc)
 
 def enable_automatic_media_scan(args):
 	'''Decide if we enable media scanning automatically.'''