~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/timestamp.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2008-06-05 04:05:05 UTC
  • mfrom: (3473.1.1 ianc-integration)
  • Revision ID: pqm@pqm.ubuntu.com-20080605040505-i9kqxg2fps2qjdi0
Add the 'alias' command (Tim Penhey)

Show diffs side-by-side

added added

removed removed

Lines of Context:
56
56
        offset = 0
57
57
    tt = time.gmtime(t + offset)
58
58
 
59
 
    return (osutils.weekdays[tt[6]] +
60
 
            time.strftime(" %Y-%m-%d %H:%M:%S", tt)
 
59
    return (time.strftime("%a %Y-%m-%d %H:%M:%S", tt)
61
60
            # Get the high-res seconds, but ignore the 0
62
61
            + ('%.9f' % (t - int(t)))[1:]
63
62
            + ' %+03d%02d' % (offset / 3600, (offset / 60) % 60))
101
100
    ...      break
102
101
 
103
102
    """
104
 
    # Weekday parsing is locale sensitive, so drop the weekday
105
 
    space_loc = date.find(' ')
106
 
    if space_loc == -1 or date[:space_loc] not in osutils.weekdays:
107
 
        raise ValueError(
108
 
            'Date string does not contain a day of week: %r' % date)
109
103
    # Up until the first period is a datestamp that is generated
110
104
    # as normal from time.strftime, so use time.strptime to
111
105
    # parse it
113
107
    if dot_loc == -1:
114
108
        raise ValueError(
115
109
            'Date string does not contain high-precision seconds: %r' % date)
116
 
    base_time = time.strptime(date[space_loc:dot_loc], " %Y-%m-%d %H:%M:%S")
 
110
    base_time = time.strptime(date[:dot_loc], "%a %Y-%m-%d %H:%M:%S")
117
111
    fract_seconds, offset = date[dot_loc:].split()
118
112
    fract_seconds = float(fract_seconds)
119
113