[New-bugs-announce] [issue18128] pygettext: non-standard timestamp format in POT-Creation-Date

Jakub Wilk report at bugs.python.org
Mon Jun 3 22:51:02 CEST 2013

New submission from Jakub Wilk:

pygettext uses non-standard timestamp format in the POT-Creation-Date field. For example:

POT-Creation-Date: 2013-06-03 22:31+CEST

whereas xgettext uses this format:

POT-Creation-Date: 2013-06-03 22:31+0200

You could use this code to generate timestamps in the same format as xgettext:

from time import time, localtime, strftime
from calendar import timegm

def gettext_timestamp():
    now = int(time())
    nowtuple = localtime(now)
    offset = timegm(nowtuple) - now
    sign = '-' if offset < 0 else '+'
    hour, minute = divmod(abs(offset) // 60, 60)
    return strftime('%Y-%m-%d %H:%M', nowtuple) + sign + '%02d%02d' % (hour, minute)

messages: 190563
nosy: jwilk
priority: normal
severity: normal
status: open
title: pygettext: non-standard timestamp format in POT-Creation-Date

Python tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list