how to get UTC timestamp for commit?
Matt Mackall
mpm at selenic.com
Tue Aug 18 21:57:05 UTC 2015
On Tue, 2015-08-18 at 22:33 +0100, Christian Ebert wrote:
> * Matt Mackall on Tuesday, August 18, 2015 at 12:40:30 -0500
> > On Tue, 2015-08-18 at 03:32 +0100, Christian Ebert wrote:
> >> The keyword extension provides an utcdate filter:
> >>
> >> $ hg --config extensions.keyword= log -l1 --template '{date|utcdate}\n'
> >> 2015/08/16 18:24:30
> >>
> >> The code looks like this:
> >> # date like in cvs' $Date
> >> def utcdate(text):
> >> ''':utcdate: Date. Returns a UTC-date in this format: "2009/08/18 11:00:13".
> >> '''
> >> return util.datestr((util.parsedate(text)[0], 0), '%Y/%m/%d %H:%M:%S')
> >>
> >>
> >> Maybe that helps.
> >
> > That's a silly place for it?
>
> I offered to make this available in core, but it wasn't deemed
> necessary. Maybe because of the '%Y/%m/%d %H:%M:%S' format, I
> don't know.
Ahh, right. What's really wanted is an analog to localdate: don't format
the date, just change the timezone. IOW:
def utcdate(date):
return (date[0], 0)
But now we have a name collision.
--
Mathematics is the supreme nostalgia of our time.
More information about the Mercurial
mailing list