Correcting for Drift between Two Dates
Erik Max Francis
max at alcyone.com
Tue Sep 9 01:14:59 EDT 2008
W. eWatson wrote:
> drift = 4.23 # seconds per day
>
> format = '%Y%m%d_%H%M%S'
> ts1 = "20080901_120000" # base date-time
> ts2 = "20080904_180000"
> d1 = datetime(*(time.strptime(ts1, format)[0:6]))
> d2 = datetime(*(time.strptime(ts2, format)[0:6]))
> #d += timedelta(seconds=sec)
> delta = d2-d1
> # delta format is nnn[n] days, hh:mm:ss
> # delta is type 'datetime.timedelta'
> print delta
> # get back to ts2 as a check
> d3 = d1+d
> print d3
You're going to have to start with code that actually runs first.
You've iterated on this so many times that it's not at all clear what it
is you're trying to do and why it isn't doing what you think it should.
--
Erik Max Francis && max at alcyone.com && http://www.alcyone.com/max/
San Jose, CA, USA && 37 18 N 121 57 W && AIM, Y!M erikmaxfrancis
It's better to be quotable than to be honest.
-- Tom Stoppard
More information about the Python-list
mailing list