# HG changeset patch # User Adrian Buehlmann # Date 2010-11-24 18:31:43 # Node ID e98581d44f0bb574aa8247572e5a7dc2b8f09465 # Parent e1002cf9fe54c8aa7d4b588c2239e23c8011e6bf makedate: abort on negative timestamps (issue2513) catches weird clock settings diff --git a/mercurial/util.py b/mercurial/util.py --- a/mercurial/util.py +++ b/mercurial/util.py @@ -1015,7 +1015,11 @@ def makedate(): tz = time.altzone else: tz = time.timezone - return time.mktime(lt), tz + t = time.mktime(lt) + if t < 0: + hint = _("check your clock") + raise Abort(_("negative timestamp: %d") % t, hint=hint) + return t, tz def datestr(date=None, format='%a %b %d %H:%M:%S %Y %1%2'): """represent a (unixtime, offset) tuple as a localized time.