diff --git a/mercurial/util.py b/mercurial/util.py --- a/mercurial/util.py +++ b/mercurial/util.py @@ -1023,6 +1023,9 @@ def datestr(date=None, format='%a %b %d number of seconds away from UTC. if timezone is false, do not append time zone to string.""" t, tz = date or makedate() + if t < 0: + t = 0 # time.gmtime(lt) fails on Windows for lt < -43200 + tz = 0 if "%1" in format or "%2" in format: sign = (tz > 0) and "-" or "+" minutes = abs(tz) // 60