mirror of
https://github.com/NoiTheCat/WorldTime.git
synced 2024-10-16 16:29:57 +00:00
15 lines
501 B
Python
15 lines
501 B
Python
|
# Common items used throughout the project
|
||
|
|
||
|
import pytz
|
||
|
from datetime import datetime
|
||
|
|
||
|
# For case-insensitive time zone lookup, map lowercase tzdata entries with
|
||
|
# entires with proper case. pytz is case sensitive.
|
||
|
tzlcmap = {x.lower():x for x in pytz.common_timezones}
|
||
|
|
||
|
def logPrint(label, line):
|
||
|
"""
|
||
|
Print with timestamp in a way that resembles some of my other projects
|
||
|
"""
|
||
|
resultstr = datetime.utcnow().strftime('%Y-%m-%d %H:%m:%S') + ' [' + label + '] ' + line
|
||
|
print(resultstr)
|