(Python) PyProgram #7 – Time Object Diffs « the minds of a tuxian
I had two time objects and needed to find the difference of time between them. Upon Googling, querying in #python and checking the documentation, found that there is not built-in function available for this. Though there were some cookbook recipes, I wanted to write my own solution to find the difference between two datetime.time objects. Though datetime.timedelta was for time difference requirements it only has a days, seconds and microseconds property while I need hour, minute and seconds. Thus, I wrote my timediff method which accepts two time objects btime and stime where btime is a bigger time than stime (b for big and s for small), and it returns a datetime.time object for the difference time. (Why I need to have time objects? I use storm ORM
)
), and it returns a datetime.time object for the difference time. (Why I need to have time objects? I use storm ORM