annotate content/Python/timedelta.md @ 77:92846a71739f pelican_comment_system

The changes were merged to the default branch.
author Dirk Olmes <dirk@xanthippe.ping.de>
date Wed, 06 Jan 2016 16:12:07 +0100
parents 6c1752a66dd0
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
4cd9b65e10e4 initial import of the pelican based blog
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
diff changeset
1 Title: timedelta
4cd9b65e10e4 initial import of the pelican based blog
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
diff changeset
2 Date: 2009-01-10
4cd9b65e10e4 initial import of the pelican based blog
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
diff changeset
3 Lang: en
4cd9b65e10e4 initial import of the pelican based blog
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
diff changeset
4
4cd9b65e10e4 initial import of the pelican based blog
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
diff changeset
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.
4cd9b65e10e4 initial import of the pelican based blog
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
diff changeset
6
54
6c1752a66dd0 change the hg url
Dirk Olmes <dirk@xanthippe.ping.de>
parents: 29
diff changeset
7 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.
0
4cd9b65e10e4 initial import of the pelican based blog
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
diff changeset
8
54
6c1752a66dd0 change the hg url
Dirk Olmes <dirk@xanthippe.ping.de>
parents: 29
diff changeset
9 The source is [publicly available from its mercurial repository](http://xanthippe.duckdns.org/hg/timedelta/).