mirror of
https://bitbucket.org/Mattrixwv/pyclasses.git
synced 2025-12-06 18:33:58 -05:00
Added a getMinutes function and rearange the get_ functions
This commit is contained in:
43
Stopwatch.py
43
Stopwatch.py
@@ -42,21 +42,9 @@ class Stopwatch:
|
|||||||
return -1
|
return -1
|
||||||
|
|
||||||
#Return a specific resolution of time. This is done as a floating point number
|
#Return a specific resolution of time. This is done as a floating point number
|
||||||
#Returns the result of getTime() in terms of seconds
|
#Returns the result of getTime() in terms of nanoseconds
|
||||||
def getSeconds(self):
|
def getNanoseconds(self):
|
||||||
second = self.getTime()
|
return self.getTime()
|
||||||
if(second < 0):
|
|
||||||
return second
|
|
||||||
else:
|
|
||||||
return (second / 1000000000)
|
|
||||||
|
|
||||||
#Returns the result of getTime() in terms of milliseconds
|
|
||||||
def getMilliseconds(self):
|
|
||||||
milli = self.getTime()
|
|
||||||
if(milli < 0):
|
|
||||||
return milli
|
|
||||||
else:
|
|
||||||
return (milli / 1000000)
|
|
||||||
|
|
||||||
#Returns the result of getTime() in terms of microseconds
|
#Returns the result of getTime() in terms of microseconds
|
||||||
def getMicroseconds(self):
|
def getMicroseconds(self):
|
||||||
@@ -66,6 +54,25 @@ class Stopwatch:
|
|||||||
else:
|
else:
|
||||||
return (micro / 1000)
|
return (micro / 1000)
|
||||||
|
|
||||||
#Returns the result of getTime() in terms of nanoseconds
|
#Returns the result of getTime() in terms of milliseconds
|
||||||
def getNanoseconds(self):
|
def getMilliseconds(self):
|
||||||
return self.getTime()
|
milli = self.getTime()
|
||||||
|
if(milli < 0):
|
||||||
|
return milli
|
||||||
|
else:
|
||||||
|
return (milli / 1000000)
|
||||||
|
#Returns the result of getTime() in terms of seconds
|
||||||
|
def getSeconds(self):
|
||||||
|
second = self.getTime()
|
||||||
|
if(second < 0):
|
||||||
|
return second
|
||||||
|
else:
|
||||||
|
return (second / 1000000000)
|
||||||
|
|
||||||
|
#Returns the result of getTime() in terms of minutes
|
||||||
|
def getMinutes(self):
|
||||||
|
minute = self.getTime()
|
||||||
|
if(minute < 0):
|
||||||
|
return minute
|
||||||
|
else:
|
||||||
|
return (minute / 60000000000)
|
||||||
|
|||||||
Reference in New Issue
Block a user