Make genvk.py work in Python2 (#894)

As a quick workaround, the Python3-specific function time.process_time()
is conditioned to the `timeit` parameter.  Indeed, if this parameter is
not set, there is no point in getting the process time anyway.

Unblocks rolling Vulkan dependencies in Google's ANGLE.

Signed-off-by: Shahbaz Youssefi <syoussefi@google.com>
This commit is contained in:
Shahbaz Youssefi 2019-01-11 22:50:12 -05:00 committed by Jon Leech
parent 1c87a7149c
commit b59ff9c1fe
1 changed files with 4 additions and 3 deletions

View File

@ -30,12 +30,13 @@ startTime = None
def startTimer(timeit): def startTimer(timeit):
global startTime global startTime
startTime = time.process_time() if timeit:
startTime = time.process_time()
def endTimer(timeit, msg): def endTimer(timeit, msg):
global startTime global startTime
endTime = time.process_time() if timeit:
if (timeit): endTime = time.process_time()
write(msg, endTime - startTime, file=sys.stderr) write(msg, endTime - startTime, file=sys.stderr)
startTime = None startTime = None