view content/Python/timedelta.md @ 99:fc7e1e904aba

Remove the template for my old comments system - it only produced weird looking markup without any value.
author Dirk Olmes <dirk@xanthippe.ping.de>
date Sat, 21 Dec 2019 06:44:17 +0100
parents 6c1752a66dd0
children
line wrap: on
line source

Title: timedelta
Date: 2009-01-10
Lang: en

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.

So I had to write my own [timedelta](http://xanthippe.duckdns.org/hg/timedelta/) function which takes two time instances and calculates the difference. The diff will be returned as a time instance.

The source is [publicly available from its mercurial repository](http://xanthippe.duckdns.org/hg/timedelta/).