mirror of
https://github.com/SickGear/SickGear.git
synced 2024-12-11 05:33:37 +00:00
13 lines
319 B
Python
13 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
|