~bzr/bzr-fastimport/0.6

« back to all changes in this revision

Viewing changes to dates.py

  • Committer: Ian Clatworthy
  • Date: 2008-02-15 07:55:31 UTC
  • Revision ID: ian.clatworthy@internode.on.net-20080215075531-6diyqa855c5lwpe3
first cut at generic processing method

Show diffs side-by-side

added added

removed removed

Lines of Context:
16
16
 
17
17
"""Date parsing routines.
18
18
 
19
 
Each routine routines a (timestamp,timezone) tuple where
20
 
timestamp is seconds since epoch and timezone is the offset
21
 
from UTC in seconds.
 
19
Each routine returns timestamp,timezone where
 
20
 
 
21
* timestamp is seconds since epoch
 
22
* timezone is the offset from UTC in seconds.
22
23
"""
23
24
 
24
25
 
25
 
import datetime
 
26
import time
26
27
 
27
28
 
28
29
def parse_raw(s):
34
35
    timestamp_str, timezone_str = s.split(' ', 1)
35
36
    timestamp = float(timestamp_str)
36
37
    timezone = _parse_tz(timezone_str)
37
 
    return (timestamp, timezone)
 
38
    return timestamp, timezone
38
39
 
39
40
 
40
41
def _parse_tz(tz):
64
65
    The format must be exactly "now".
65
66
    See the spec for details.
66
67
    """
67
 
    return (datetime.datetime.now(),0)
 
68
    return time.time(), 0
68
69
 
69
70
 
70
71
# Lookup tabel of date parsing routines