Mercurial > hg
diff mercurial/formatter.py @ 37770:31750413f8d7
formatter: convert timestamp to int
Spotted while porting jsonchangeset printer to formatter. A timestamp may be
float type, but its meaningful part is just int.
author | Yuya Nishihara <yuya@tcha.org> |
---|---|
date | Fri, 13 Apr 2018 22:58:49 +0900 |
parents | d110167610db |
children | 395571419274 |
line wrap: on
line diff
--- a/mercurial/formatter.py Tue Apr 17 03:07:01 2018 +0200 +++ b/mercurial/formatter.py Fri Apr 13 22:58:49 2018 +0900 @@ -144,7 +144,9 @@ @staticmethod def formatdate(date, fmt): '''convert date tuple to appropriate format''' - return date + # timestamp can be float, but the canonical form should be int + ts, tz = date + return (int(ts), tz) @staticmethod def formatdict(data, key, value, fmt, sep): '''convert dict or key-value pairs to appropriate dict format'''