@@ -2217,12 +2217,12 @@ def new_from_nsec(cls, nsec) -> "Timespec64Concrete":
22172217
22182218 # Based on ns_to_timespec64()
22192219 if nsec > 0 :
2220- tv_sec = nsec // NSEC_PER_SEC
2221- tv_nsec = nsec % NSEC_PER_SEC
2220+ tv_sec = nsec // linux_constants . NSEC_PER_SEC
2221+ tv_nsec = nsec % linux_constants . NSEC_PER_SEC
22222222 elif nsec < 0 :
2223- tv_sec = - ((- nsec - 1 ) // NSEC_PER_SEC ) - 1
2224- rem = (- nsec - 1 ) % NSEC_PER_SEC
2225- tv_nsec = NSEC_PER_SEC - rem - 1
2223+ tv_sec = - ((- nsec - 1 ) // linux_constants . NSEC_PER_SEC ) - 1
2224+ rem = (- nsec - 1 ) % linux_constants . NSEC_PER_SEC
2225+ tv_nsec = linux_constants . NSEC_PER_SEC - rem - 1
22262226 else :
22272227 tv_sec = tv_nsec = 0
22282228
@@ -2233,13 +2233,15 @@ def to_datetime(self) -> datetime.datetime:
22332233
22342234 # pylint: disable=E1101
22352235 return conversion .unixtime_to_datetime (
2236- self .tv_sec + self .tv_nsec / NSEC_PER_SEC
2236+ self .tv_sec + self .tv_nsec / linux_constants . NSEC_PER_SEC
22372237 )
22382238
22392239 def to_timedelta (self ) -> datetime .timedelta :
22402240 """Converts this Timespec64Abstract subclass object to timedelta"""
22412241 # pylint: disable=E1101
2242- return datetime .timedelta (seconds = self .tv_sec + self .tv_nsec / NSEC_PER_SEC )
2242+ return datetime .timedelta (
2243+ seconds = self .tv_sec + self .tv_nsec / linux_constants .NSEC_PER_SEC
2244+ )
22432245
22442246 def __add__ (self , other ) -> "Timespec64Concrete" :
22452247 """Returns a new Timespec64Concrete object that sums the current values with those
@@ -2282,12 +2284,12 @@ def normalize(self):
22822284 # Based on kernel's set_normalized_timespec64()
22832285
22842286 # pylint: disable=E1101
2285- while self .tv_nsec >= NSEC_PER_SEC :
2286- self .tv_nsec -= NSEC_PER_SEC
2287+ while self .tv_nsec >= linux_constants . NSEC_PER_SEC :
2288+ self .tv_nsec -= linux_constants . NSEC_PER_SEC
22872289 self .tv_sec += 1
22882290
22892291 while self .tv_nsec < 0 :
2290- self .tv_nsec += NSEC_PER_SEC
2292+ self .tv_nsec += linux_constants . NSEC_PER_SEC
22912293 self .tv_sec -= 1
22922294
22932295
0 commit comments