Run (Version 3)

A module to store information about time, also works out calculations about time.

from PythonFunctions import Run

Mark

Mark()

Adds a new marker

Returns

The marker index

Return type

int

index = Run.Mark()
print(index)

GetMarkTime

GetMarkTime(x)

Get the time that mark X has

Parameters

x (int) – The marker index to get the time of

Returns

The time at that point

Return type

float

Raises

IndexError – The provided marker was not in range of all of the markers

time = Run.GetMarkTime(index)
print(time)

CompareIndex

CompareIndex(a, b)

Compare the marked times between a and b

Parameters
  • a (int) – The first marker

  • b (int) – The second marker

Returns

The time difference

Return type

float

Raises

IndexError – One of the provided markers was not in range of all of the markers

# Get two different times
a = Run.Mark()
time.sleep(1)
b = Run.Mark()

# Compare
dif = Run.CompareIndex(a, b)
print(diff)

End

End()

Return the amount of time has passed sinces the file got imported (started)

Returns

Amount of time passed

Return type

float

print(Run.End())

Timer

Note

This is not used like the other functions.

The purpose of this is to check how long it takes a function to run. To use it follow the code below.

@Run.Timer
def test():
    print('a')
    time.sleep(1)
    print('b')

This above code will print off a and b and the time it took. (test took X seconds).