I need to get the difference between two timestamps in SQLite. While searching, I found this question, and while the accepted answer seems to work at first glance, it looses a lot of precision:
Taking this query
select timestamp, EndTimeStamp, ((julianday(EndTimeStamp)-julianday(timestamp)) * 86400.0) as Duration from X
I get this result:
"2016-04-18 13:44:31.630916" "2016-04-18 13:44:31.63114" "0.00100582838058472"
"2016-04-18 13:44:31.6315231" "2016-04-18 13:44:31.6316997" "0.0"
"2016-04-18 13:44:31.6320359" "2016-04-18 13:44:31.632202" "0.0"
"2016-04-18 13:44:31.6326964" "2016-04-18 13:44:31.6329361" "0.0"
As you can see, the three last results have a calculated difference of Zero, but the timestamps are actually different.
Is it possible, in SQL, with the DATETIME field type, to calculate a precise difference? I would prefer to not need to fallback to C#.