Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def timesec():
- """This function converts the current time into seconds since start of day"""
- # import the function to get time as tuple
- from time import localtime
- currtime = localtime()
- # convert current time into seconds
- sec = (currtime[3] * 3600) + (currtime[4] * 60) + currtime[5]
- return sec
- def metrictime(sec):
- """This function converts seconds since start of day into metric time as tuple in format ks:sec"""
- # Converts time to kiloseconds and seconds
- time = ((sec / 1000), (sec % 1000))
- return time
- # Calling the functions
- time = metrictime(timesec())
- print time[0], ":", time[1], "ks"
Advertisement
Add Comment
Please, Sign In to add comment