comparison content/Python/timedelta.md @ 0:4cd9b65e10e4

initial import of the pelican based blog
author Dirk Olmes <dirk@xanthippe.ping.de>
date Fri, 28 Jun 2013 08:48:58 +0200
parents
children 04a8afe79c59
comparison
equal deleted inserted replaced
-1:000000000000 0:4cd9b65e10e4
1 Title: timedelta
2 Date: 2009-01-10
3 Lang: en
4
5 Python comes with a rich libray of classes for dealing with date and time. I was working with datetime.time objects the other day and needed to calculate the difference between to time instances. To my great surprise this isn't easily doable as Python's standard lib only has `timedelta` objects which cannot deal with pure time objects.
6
7 So I had to write my own [timedelta](http://xanthippe.dyndns.org/cgi-bin/hgwebdir.cgi/timedelta/shortlog/tip) function which takes two time instances and calculates the difference. The diff will be returned as a time instance.
8
9 The source is [publicly available from its mercurial repository](http://xanthippe.dyndns.org/hg/timedelta/shortlog/tip).