Sebastiaan wrote:

> No. From your original patch:

>  +            int(os.environ.get('SOURCE_DATE_EPOCH', time.time())),

time.time() as the second argument to dict.get is the fallback
mechanism.

>  +                int(os.environ.get('SOURCE_DATE_EPOCH', time.time())),

.. which then somewhat pointless in your patch.


If you prefer the more explicit form, I would actually recommend:

    try:
        now = datetime.datetime.utctimestamp(
             int(os.environ['SOURCE_DATE_EPOCH']),
        )
    except KeyError:
        now = datetime.datetime.now()

As that removes the ugly duplicate reference to 'SOURCE_DATE_EPOCH'.


Regards,

-- 
      ,''`.
     : :'  :     Chris Lamb
     `. `'`      [email protected] / chris-lamb.co.uk
       `-

Reply via email to