Skip to content

Commit

Permalink
Merge 9fd7268 into 770f4ca
Browse files Browse the repository at this point in the history
  • Loading branch information
bobbyi committed Mar 25, 2015
2 parents 770f4ca + 9fd7268 commit d7bb3d2
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions freezegun/api.py
Expand Up @@ -47,8 +47,9 @@ def __call__(self, t=None):


class FakeGMTTime(object):
def __init__(self, time_to_freeze):
def __init__(self, time_to_freeze, previous_gmtime_function):
self.time_to_freeze = time_to_freeze
self.previous_gmtime_function = previous_gmtime_function

def __call__(self, t=None):
if t is not None:
Expand Down Expand Up @@ -259,7 +260,7 @@ def start(self):
datetime.date = FakeDate
fake_time = FakeTime(self.time_to_freeze, time.time)
fake_localtime = FakeLocalTime(self.time_to_freeze)
fake_gmtime = FakeGMTTime(self.time_to_freeze)
fake_gmtime = FakeGMTTime(self.time_to_freeze, time.gmtime)
fake_strftime = FakeStrfTime(self.time_to_freeze)
time.time = fake_time
time.localtime = fake_localtime
Expand Down Expand Up @@ -330,6 +331,7 @@ def stop(self):
copyreg.dispatch_table.pop(real_date)

time.time = time.time.previous_time_function
time.gmtime = time.gmtime.previous_gmtime_function

for module, module_attribute, original_value in self.undo_changes:
setattr(module, module_attribute, original_value)
Expand Down

0 comments on commit d7bb3d2

Please sign in to comment.