~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/osutils.py

  • Committer: mbp at sourcefrog
  • Date: 2005-03-19 01:41:44 UTC
  • Revision ID: mbp@sourcefrog.net-20050319014144-5298a74caebaf378
fix local-time-offset calculation

Show diffs side-by-side

added added

removed removed

Lines of Context:
174
174
 
175
175
 
176
176
 
177
 
def local_time_offset():
178
 
    if time.daylight:
 
177
def local_time_offset(t=None):
 
178
    """Return offset of local zone from GMT, either at present or at time t."""
 
179
    if time.localtime(t).tm_isdst and time.daylight:
179
180
        return -time.altzone
180
181
    else:
181
182
        return -time.timezone
197
198
        tt = time.gmtime(t + offset)
198
199
    elif timezone == 'local':
199
200
        tt = time.localtime(t)
200
 
        offset = local_time_offset()
 
201
        offset = local_time_offset(t)
201
202
    else:
202
203
        bailout("unsupported timezone format %r",
203
204
                ['options are "utc", "original", "local"'])