72
72
:param date: A date formated by format_highres_date
75
>>> import time, random
76
>>> unpack_highres_date('Thu 2005-06-30 12:38:52.350850105 -0500')
77
(1120153132.3508501, -18000)
78
>>> unpack_highres_date('Thu 2005-06-30 17:38:52.350850105 +0000')
79
(1120153132.3508501, 0)
80
>>> unpack_highres_date('Thu 2005-06-30 19:38:52.350850105 +0200')
81
(1120153132.3508501, 7200)
82
>>> unpack_highres_date('Sun 2006-07-09 12:35:38.867522001 +0530')
83
(1152428738.867522, 19800)
84
>>> from bzrlib.osutils import local_time_offset
86
>>> o = local_time_offset()
87
>>> t2, o2 = unpack_highres_date(format_highres_date(t, o))
92
>>> t -= 24*3600*365*2 # Start 2 years ago
94
>>> for count in xrange(500):
95
... t += random.random()*24*3600*30
96
... o = ((o/3600 + 13) % 25 - 12)*3600 # Add 1 wrap around from [-12, 12]
97
... date = format_highres_date(t, o)
98
... t2, o2 = unpack_highres_date(date)
99
... if t != t2 or o != o2:
100
... print 'Failed on date %r, %s,%s diff:%s' % (date, t, o, t2-t)
104
76
# Weekday parsing is locale sensitive, so drop the weekday
105
77
space_loc = date.find(' ')