Linux: Boottime API: Minor. Move negate() up

This commit is contained in:
Gustavo Moreira
2024-10-30 15:36:46 +11:00
parent 42d918c05d
commit 7abe92cf2f
@@ -2244,6 +2244,18 @@ class Timespec64Abstract(abc.ABC):
result.normalize()
return self + other.negate()
def negate(self):
"""Returns a new Timespec64Concrete object with the values of the current object negated"""
# pylint: disable=E1101
result = Timespec64Concrete(
tv_sec=-self.tv_sec,
tv_nsec=-self.tv_nsec,
)
result.normalize()
return result
def normalize(self):
@@ -2259,18 +2271,6 @@ class Timespec64Abstract(abc.ABC):
self.tv_nsec += NSEC_PER_SEC
self.tv_sec -= 1
def negate(self):
"""Returns a new Timespec64Concrete object with the values of the current object negated"""
# pylint: disable=E1101
result = Timespec64Concrete(
tv_sec=-self.tv_sec,
tv_nsec=-self.tv_nsec,
)
result.normalize()
return result
class Timespec64Concrete(Timespec64Abstract):
"""Handle all required timespec64 operations, convertions and adjustments.