~ahasenack/landscape-client/landscape-client-1.5.5-0ubuntu0.9.04.0

« back to all changes in this revision

Viewing changes to landscape/lib/timestamp.py

  • Committer: Bazaar Package Importer
  • Author(s): Rick Clark
  • Date: 2008-09-08 16:35:57 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20080908163557-l3ixzj5dxz37wnw2
Tags: 1.0.18-0ubuntu1
New upstream release 

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
from datetime import datetime
 
2
 
 
3
 
 
4
def to_timestamp(date, epoch=datetime.utcfromtimestamp(0)):
 
5
    """Convert a C{datetime} to an C{int}-based timetamp."""
 
6
    delta = date - epoch
 
7
    return (delta.days * 60 * 60 * 24) + delta.seconds