File: util.py

package info (click to toggle)
trac-xmlrpc 1.0.6%2Bsvn6598-1
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 308 kB
  • ctags: 427
  • sloc: python: 2,413; cs: 100; makefile: 4
file content (5 lines) | stat: -rw-r--r-- 224 bytes parent folder | download | duplicates (5)
1
2
3
4
5
import time

def to_timestamp(datetime):
    """ Convert xmlrpclib.DateTime string representation to UNIX timestamp. """
    return time.mktime(time.strptime('%s UTC' % datetime.value, '%Y%m%dT%H:%M:%S %Z')) - time.timezone