~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/osutils.py

  • Committer: Martin Pool
  • Date: 2008-07-03 10:44:34 UTC
  • mfrom: (3512.3.2 setlocale.mini)
  • mto: This revision was merged to the branch mainline in revision 3518.
  • Revision ID: mbp@sourcefrog.net-20080703104434-v4qgzvxd2wxg8etl
Set locale from environment for third party libs and day of week.

Show diffs side-by-side

added added

removed removed

Lines of Context:
641
641
    offset = datetime.fromtimestamp(t) - datetime.utcfromtimestamp(t)
642
642
    return offset.days * 86400 + offset.seconds
643
643
 
 
644
weekdays = ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']
644
645
    
645
646
def format_date(t, offset=0, timezone='original', date_fmt=None,
646
647
                show_offset=True):
672
673
        offset_str = ' %+03d%02d' % (offset / 3600, (offset / 60) % 60)
673
674
    else:
674
675
        offset_str = ''
 
676
    # day of week depends on locale, so we do this ourself
 
677
    date_fmt = date_fmt.replace('%a', weekdays[tt[6]])
675
678
    return (time.strftime(date_fmt, tt) +  offset_str)
676
679
 
677
680