Skip to content

Commit

Permalink
Adding timezone utility functions.
Browse files Browse the repository at this point in the history
  • Loading branch information
gkrimer committed Nov 26, 2015
1 parent 7b4e131 commit e75f974
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 3 deletions.
Empty file added common/utils/__init__.py
Empty file.
18 changes: 18 additions & 0 deletions common/utils/timezone.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import pytz
import datetime


def now():
"""
Returns a timezone-aware datetime representing the current time in UTC.
"""

return datetime.datetime.utcnow().replace(tzinfo=pytz.utc)


def bogota_now():
"""
Return a a timezone-aware datetime representing the current time in Bogotá, Colombia.
"""

return now().astimezone(pytz.timezone('America/Bogota'))
11 changes: 8 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,19 @@
from setuptools import setup

setup(name='common',
version='0.1.1',
version='0.1.2',
author='Unascribed',
author_email='[email protected]',
description='Code intended to be used across Polymath Ventures repositories.',
license='BSD',
url='https://github.com/PolymathVentures/common',
packages=['common', 'common.test'],
install_requires=['PyYAML>=3.11', 'Flask>=0.10.1', 'Flask-SQLAlchemy>=2.0'],
packages=['common',
'common.test',
'common.utils'],
install_requires=['PyYAML>=3.11',
'Flask>=0.10.1',
'Flask-SQLAlchemy>=2.0',
'pytz>=2015.4'],
classifiers=[
'Development Status :: 3 - Alpha',
'Topic :: Utilities',
Expand Down

0 comments on commit e75f974

Please sign in to comment.