[PATCH] xfs_scrub_all: Replace deprecated datetime.utcnow

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

Closes: #1112588
Signed-off-by: Bastian Germann <bage@xxxxxxxxxx>
---
 scrub/xfs_scrub_all.py.in | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/scrub/xfs_scrub_all.py.in b/scrub/xfs_scrub_all.py.in
index 515cc144..a94b1b71 100644
--- a/scrub/xfs_scrub_all.py.in
+++ b/scrub/xfs_scrub_all.py.in
@@ -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.'''




[Index of Archives]     [XFS Filesystem Development (older mail)]     [Linux Filesystem Development]     [Linux Audio Users]     [Yosemite Trails]     [Linux Kernel]     [Linux RAID]     [Linux SCSI]


  Powered by Linux