~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/timestamp.py

  • Committer: Martin Pool
  • Date: 2007-04-19 08:03:19 UTC
  • mto: This revision was merged to the branch mainline in revision 2461.
  • Revision ID: mbp@sourcefrog.net-20070419080319-amc7f3frr64lxolq
Make timestamps use existing format_date; document that function more

Show diffs side-by-side

added added

removed removed

Lines of Context:
17
17
import calendar
18
18
import time
19
19
 
 
20
from bzrlib import osutils
 
21
 
20
22
 
21
23
def format_highres_date(t, offset=0):
22
24
    """Format a date, such that it includes higher precision in the
138
140
        from warnings import warn
139
141
        warn("gmtime of negative time (%s, %s) may not work on Windows" %
140
142
                (secs, offset))
141
 
    tm = time.gmtime(secs+offset)
142
 
    time_str = time.strftime('%Y-%m-%d %H:%M:%S', tm)
143
 
    return '%s %+03d%02d' % (time_str, offset/3600, abs(offset/60) % 60)
 
143
    return osutils.format_date(secs, offset=offset,
 
144
            date_fmt='%Y-%m-%d %H:%M:%S')
144
145
 
145
146
 
146
147
def parse_patch_date(date_str):