summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xmorphlib/app.py19
1 files changed, 6 insertions, 13 deletions
diff --git a/morphlib/app.py b/morphlib/app.py
index 7f2e01d5..f4dd3403 100755
--- a/morphlib/app.py
+++ b/morphlib/app.py
@@ -168,21 +168,14 @@ class Morph(cliapp.Application):
metavar='PREFIX',
default=defaults['build-ref-prefix'])
- def check_mtime(self):
- # Check the mtime for the file to make sure the system clock has been
- # set
- try:
- file_mtime = os.path.getmtime(__file__)
- except OSError as e:
- raise morphlib.Error('%s %s' % (e.strerror, e.filename))
-
- sys_time = time.time()
- if file_mtime > sys_time:
- raise morphlib.Error('mtime for %s is in the future, please set '
- 'your system clock' % __file__)
+ def check_time(self):
+ # Check that the current time is not far in the past.
+ if time.localtime(time.time()).tm_year < 2012:
+ raise morphlib.Error(
+ 'System time is far in the past, please set your system clock')
def process_args(self, args):
- self.check_mtime()
+ self.check_time()
# Combine the aliases into repo-alias before passing on to normal
# command processing. This means everything from here on down can