mirror of
https://github.com/SickGear/SickGear.git
synced 2024-12-01 00:43:37 +00:00
12 lines
319 B
Python
12 lines
319 B
Python
# -*- coding: utf-8 -*-
|
|
from __future__ import unicode_literals
|
|
|
|
|
|
def within_delta(dt1, dt2, delta):
|
|
"""
|
|
Useful for comparing two datetimes that may a negilible difference
|
|
to be considered equal.
|
|
"""
|
|
delta = abs(delta)
|
|
difference = dt1 - dt2
|
|
return -delta <= difference <= delta
|