Every line of 'timedelta to seconds' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your Python code is secure.
259 def timedelta_total_seconds(td): 260 """Handle backwards compatibility for timedelta.total_seconds.""" 261 if hasattr(td, 'total_seconds'): 262 return td.total_seconds() 263 return float(td.microseconds + (td.seconds + td.days * 24 * 3600) * 10**6) / 10**6
39 def seconds_to_timedelta(value): 40 """ 41 Converst the given value in secodns to datetime.timedelta. 42 """ 43 _days = value // 86400 44 _hours = (value // 3600) % 24 45 _mins = (value // 60) % 60 46 _secs = value % 60 47 return timedelta(days=_days, hours=_hours, minutes=_mins, seconds=_secs)
845 def GetTimeDeltaUntilTime( timestamp ): 846 847 time_remaining = timestamp - GetNow() 848 849 return max( time_remaining, 0 )
129 def __get_timedelta_sec(self): 130 dt = self.__datetime.utcoffset() 131 132 return int( 133 dt.days * self.__DAYS_TO_SECONDS_COEF 134 + float(dt.seconds) 135 + dt.microseconds / self.__MICROSECONDS_TO_SECONDS_COEF 136 )
669 def _convert_to_timedelta(self, seconds, millis=True): 670 return timedelta(seconds=seconds)