Skip to content

Commit

Permalink
Fix cq and itu zomes, fix datetime
Browse files Browse the repository at this point in the history
  • Loading branch information
0x9900 committed Jul 17, 2024
1 parent c9f774d commit c641e55
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions eqsl/_eqsl.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
import warnings
from argparse import ArgumentParser, FileType
from dataclasses import asdict, dataclass
from datetime import datetime
from datetime import datetime, timezone
from email.mime.application import MIMEApplication
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText
Expand Down Expand Up @@ -212,8 +212,8 @@ def card(qso, signature, image_name=None):
textbox.text((x_pos, y_pos+65), f'Date: {date}', font=font_text, fill=config.text_color)
textbox.text((x_pos, y_pos+90), f' Rig: {qso.my_rig} • Power: {int(qso.tx_pwr):d} Watt',
font=font_text, fill=config.text_color)
textbox.text((x_pos, y_pos+115), (f'Grid: {qso.my_gridsquare}CQ Zone: {config.ituzone} • '
f'ITU Zone: {config.cqzone}'),
textbox.text((x_pos, y_pos+115), (f'Grid: {qso.my_gridsquare}ITU Zone: {config.ituzone} • '
f'CQ Zone: {config.cqzone}'),
font=font_text, fill=config.text_color)
if qso.sota_ref:
textbox.text((x_pos, y_pos+140), f'SOTA: Summit Reference ({qso.sota_ref})',
Expand Down Expand Up @@ -310,7 +310,7 @@ def already_sent(qso):
try:
with dbm.open(config.qsl_cache, 'r') as qdb:
cached = marshal.loads(qdb[key])
if cached['_cache_time'] > datetime.utcnow().timestamp() - CACHE_EXPIRE:
if cached['_cache_time'] > datetime.now(timezone.utc).timestamp() - CACHE_EXPIRE:
return True
except dbm.error:
pass
Expand All @@ -320,7 +320,7 @@ def already_sent(qso):
try:
with dbm.open(config.qsl_cache, 'c') as qdb:
cache = asdict(qso)
cache['_cache_time'] = datetime.utcnow().timestamp()
cache['_cache_time'] = datetime.now(timezone.utc).timestamp()
qdb[key] = marshal.dumps(cache)
except IOError as err:
logging.warning(err)
Expand Down

0 comments on commit c641e55

Please sign in to comment.