File: util.py

package info (click to toggle)
trac-xmlrpc 1.1.5%2Br15671-1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 320 kB
  • ctags: 416
  • sloc: python: 2,996; cs: 37; makefile: 2
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