Hi Daniel, thanks for your reply apologies for the muddled question.
What I need to do is the following:
I receive a piece of data from the serial port, determine node and
timestamp it.
then when I receive the next piece of date form the same node I
timestamp it and determine the time difference form the previous
reading.
Before using Django I was timestamping data with:
time_start = time.strftime( '%Y-%m-%d %H:%M:%S' )
and computing time difference with:
time_difference = int( time.mktime( time_end ) - time.mktime
( time_start ) )
that didn't work with django because of the format required by
DateTimeField()
now I'm doing:
>>> time_start = datetime.datetime.now()
>>> time_start
datetime.datetime(2009, 9, 8, 15, 46, 9, 544688)
>>> time_end = datetime.datetime.now()
>>> time_end
datetime.datetime(2009, 9, 8, 15, 46, 32, 353081)
>>> time_diff = time_start - time_end
>>> time_diff
datetime.timedelta(-1, 86377, 191607)
>>> print int(time_diff)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: int() argument must be a string or a number, not
'datetime.timedelta'
how would you compute the time_diff between the two datetime.datetime
objects?
Thank you,