~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/osutils.py

  • Committer: Martin Pool
  • Date: 2005-03-13 05:28:56 UTC
  • Revision ID: mbp@sourcefrog.net-20050313052856-3edd84094687cb11
remove dead commands

Show diffs side-by-side

added added

removed removed

Lines of Context:
86
86
    ## XXX: Could alternatively read /proc/sys/kernel/random/uuid on
87
87
    ## Linux, but we need something portable for other systems;
88
88
    ## preferably an implementation in Python.
89
 
    try:
90
 
        return chomp(file('/proc/sys/kernel/random/uuid').readline())
91
 
    except IOError:
92
 
        return chomp(os.popen('uuidgen').readline())
93
 
 
 
89
    bailout('uuids not allowed!')
 
90
    return chomp(os.popen('uuidgen').readline())
94
91
 
95
92
def chomp(s):
96
93
    if s and (s[-1] == '\n'):
177
174
 
178
175
 
179
176
 
180
 
def local_time_offset(t=None):
181
 
    """Return offset of local zone from GMT, either at present or at time t."""
182
 
    if time.localtime(t).tm_isdst and time.daylight:
 
177
def local_time_offset():
 
178
    if time.daylight:
183
179
        return -time.altzone
184
180
    else:
185
181
        return -time.timezone
201
197
        tt = time.gmtime(t + offset)
202
198
    elif timezone == 'local':
203
199
        tt = time.localtime(t)
204
 
        offset = local_time_offset(t)
 
200
        offset = local_time_offset()
205
201
    else:
206
202
        bailout("unsupported timezone format %r",
207
203
                ['options are "utc", "original", "local"'])