fix leapday issue in relative timestamp function
This commit is contained in:
parent
bcef6330cc
commit
338fd54e6b
|
@ -12,6 +12,7 @@ from module import commands
|
|||
def BQstatus(bot, trigger):
|
||||
"""
|
||||
Displays the current status of BQ.
|
||||
https://twitter.com/Quidam_Asinus/status/1067130989422489600
|
||||
"""
|
||||
status = "\x0304DEAD"
|
||||
deathdate = datetime(2017, 2, 16, 0, 19, 0)
|
||||
|
|
2
tools.py
2
tools.py
|
@ -4,6 +4,7 @@ Some helper functions and other tools.
|
|||
"""
|
||||
import re
|
||||
import argparse
|
||||
import calendar
|
||||
import threading
|
||||
from collections import defaultdict
|
||||
from datetime import datetime
|
||||
|
@ -231,6 +232,7 @@ def relative_time(time_1, time_2):
|
|||
units['year'] = diff.days // 365
|
||||
if diff.days >= 0:
|
||||
units['day'] = diff.days - units.get('year', 0)*365
|
||||
units['day'] -= calendar.leapdays(time_2.year, time_1.year)
|
||||
|
||||
if not any(units.values()):
|
||||
if diff.seconds // 3600:
|
||||
|
|
Loading…
Reference in New Issue
Block a user