~fgallaire/bzr/fix-localtime

« back to all changes in this revision

Viewing changes to bzrlib/timestamp.py

  • Committer: Tarmac
  • Author(s): Florent Gallaire
  • Date: 2017-03-17 12:23:47 UTC
  • mfrom: (6621.1.1 fix-gmtime-lite)
  • Revision ID: tarmac-20170317122347-2nnf3cicpgrhux3h
Fix for Windows and 32-bit platforms buggy gmtime(). [r=vila,richard-wilbur]

Show diffs side-by-side

added added

removed removed

Lines of Context:
57
57
    # revision XML entry will be reproduced faithfully.
58
58
    if offset is None:
59
59
        offset = 0
60
 
    tt = time.gmtime(t + offset)
 
60
    tt = osutils.gmtime(t + offset)
61
61
 
62
62
    return (osutils.weekdays[tt[6]] +
63
63
            time.strftime(" %Y-%m-%d %H:%M:%S", tt)
119
119
    # give the epoch in utc
120
120
    if secs == 0:
121
121
        offset = 0
122
 
    if secs + offset < 0:
123
 
        from warnings import warn
124
 
        warn("gmtime of negative time (%s, %s) may not work on Windows" %
125
 
                (secs, offset))
126
122
    return osutils.format_date(secs, offset=offset,
127
123
            date_fmt='%Y-%m-%d %H:%M:%S')
128
124