Robert Dailey wrote: > Hi, > > I'm well aware of the datetime module, however it is really inconsistent > and useless to me. In order to do any arithmetic on time objects, I have > to use the 'timedelta' class, which doesn't even allow me to do all the > math I want to do. > > For example, I want to do "1 / timeobj", where timeobj might represent a > time in the format of "00:00:00.000000". Do I have to code my own class > for this, or is there some other third party library out there that will > allow me to do this? > > Thanks. > But surely all you really need is a function to convert a timedelta to seconds. Like:
secs(td): return (td.days*24*3600)+td.seconds+(td.microseconds/1000000.0) So I don't really see the need for a third party library. It may be useless to you: have you considered that your use case might be non-standard? Or perhaps you just like to make things difficult. Once you have your times in seconds then rate calculations are a piece of cake. regards Steve -- Steve Holden +1 571 484 6266 +1 800 494 3119 Holden Web LLC/Ltd http://www.holdenweb.com Skype: holdenweb http://del.icio.us/steve.holden --------------- Asciimercial ------------------ Get on the web: Blog, lens and tag the Internet Many services currently offer free registration ----------- Thank You for Reading ------------- -- http://mail.python.org/mailman/listinfo/python-list