##// END OF EJS Templates
utils: stop using datetime.utcfromtimestamp() deprecated in Python 3.12...
Mads Kiilerich -
r51645:faccec1e stable
parent child Browse files
Show More
@@ -567,8 +567,10 b' class mapfile(dict):'
567
567
568 def makedatetimestamp(t):
568 def makedatetimestamp(t):
569 """Like dateutil.makedate() but for time t instead of current time"""
569 """Like dateutil.makedate() but for time t instead of current time"""
570 delta = datetime.datetime.utcfromtimestamp(
570 tz = round(
571 t
571 t
572 ) - datetime.datetime.fromtimestamp(t)
572 - datetime.datetime.fromtimestamp(t)
573 tz = delta.days * 86400 + delta.seconds
573 .replace(tzinfo=datetime.timezone.utc)
574 .timestamp()
575 )
574 return t, tz
576 return t, tz
@@ -83,10 +83,14 b' def makedate(timestamp=None):'
83 raise error.InputError(
83 raise error.InputError(
84 _(b"negative timestamp: %d") % timestamp, hint=hint
84 _(b"negative timestamp: %d") % timestamp, hint=hint
85 )
85 )
86 delta = datetime.datetime.utcfromtimestamp(
86 tz = round(
87 timestamp
87 timestamp
88 ) - datetime.datetime.fromtimestamp(timestamp)
88 - datetime.datetime.fromtimestamp(
89 tz = delta.days * 86400 + delta.seconds
89 timestamp,
90 )
91 .replace(tzinfo=datetime.timezone.utc)
92 .timestamp()
93 )
90 return timestamp, tz
94 return timestamp, tz
91
95
92
96
General Comments 0
You need to be logged in to leave comments. Login now