I am trying to get the recorded value by specifying AFRetrievalMode.AtOrBefore, but PiPoint always returning before value not at the exact.
related screen shot below.
Can you check the Timestamp.UtcTime.Ticks property of the value at 6:43? This could be due to the value being slightly after your request time. You could also try and see what AtOrAfter gives you.
Yes.. You were right.. StartTime that I was looking for was exact 8/20/2017 6:43:00 AM, but in the Pi archive event 8/20/2017 6:43:00 AM + few milliseconds,so that's why Pi was returning 8/20/2017 6:42:54 AM
Is it possible that subseconds could be at play here? The Timestamp.UtcTime.Ticks suggestion by David Moler could shed some light on that. The Ticks returns a long (Int64) and subseconds would be shown in the 7 rightmost digits (0 - 10 million). Since you've already got your hands deep in the code, this may be the most direct route.
Other ways to check on subseconds:
Great to see you accepted David Moler 's reply as the answer. Could you help out other community members who may be experiencing similar issues by helping to explain what you discovered by following David's advice? For example, by examining the Ticks, did you discover that the archived time in question included subseconds, which explains the observed behavior? It really could help others if you could close the loop on this question. Thanks!
Retrieving data ...