Skip to content

Commit

Permalink
Merge 6e69b48 into c1ab91a
Browse files Browse the repository at this point in the history
  • Loading branch information
jgeewax committed May 5, 2013
2 parents c1ab91a + 6e69b48 commit 124093e
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions freezegun/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,4 +175,13 @@ def wrapper(*args, **kwargs):


def freeze_time(time_to_freeze, tz_offset=0):
if isinstance(time_to_freeze, datetime.date):
time_to_freeze = time_to_freeze.strftime('%X')
elif isinstance(time_to_freeze, datetime.datetime):
time_to_freeze = time_to_freeze.strftime('%X %x')

if not isinstance(time_to_freeze, basestring):
raise TypeError(('freeze_time() expected a string '
'but got type %s.') % type(time_to_freeze))

return _freeze_time(time_to_freeze, tz_offset)

0 comments on commit 124093e

Please sign in to comment.