mirror of
https://github.com/python/cpython.git
synced 2025-08-03 16:39:00 +00:00
The usual.
This commit is contained in:
parent
887d072cc0
commit
e03c050595
25 changed files with 363 additions and 181 deletions
|
@ -109,7 +109,7 @@ _prefix = None
|
|||
def choose_boundary():
|
||||
global _prefix
|
||||
import time
|
||||
import rand
|
||||
import random
|
||||
if _prefix == None:
|
||||
import socket
|
||||
import os
|
||||
|
@ -122,10 +122,9 @@ def choose_boundary():
|
|||
pid = `os.getpid()`
|
||||
except:
|
||||
pid = '1'
|
||||
seed = `rand.rand()`
|
||||
_prefix = hostid + '.' + uid + '.' + pid
|
||||
timestamp = `int(time.time())`
|
||||
seed = `rand.rand()`
|
||||
timestamp = '%.3f' % time.time()
|
||||
seed = `random.randint(0, 32767)`
|
||||
return _prefix + '.' + timestamp + '.' + seed
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue