## Timestamp extraction

astrobro
Posts: 2
Joined: Wed Oct 11, 2017 8:53 pm

### Timestamp extraction

Hi!
I need help extracting the timestamp from AVI recorded with Sharpcap. I read the manual and I see the standard is first 8 bytes as a 64bit integer. I tried taking the first 8 bytes: 142 143 242 144 75 12 213 8 and then treating them as 100ns tics and I some keep getting around 45,000 for the number of years, though I could be doing something wrong in my code. Am I just assembling this 8 pixels as one giant integer 14214324214475122138 ? The date should come out to 2017 10 05 23h....

Thanks!

Posts: 1657
Joined: Sat Feb 11, 2017 3:52 pm
Location: Vale of the White Horse, UK
Contact:

### Re: Timestamp extraction

Hi,

this C# code correctly extracts the date from your data

Code: Select all

            var data = new byte[] {142, 143, 242, 144, 75, 12, 213, 8};
var longData = BitConverter.ToInt64(data, 0);

Console.WriteLine(new DateTime(longData));

// Result - 05/10/2017 23:48:23

I expect you have the bytes in the wrong order - you need to interpret 8 as the most significant byte down to 142 as the least significant.

cheers,

Robin

astrobro
Posts: 2
Joined: Wed Oct 11, 2017 8:53 pm

### Re: Timestamp extraction

Ah ok! I had it reversed in Matlab. The other funny thing is that Matlab uses a different starting point, 0-Jan-0000, by default. I might just try to see if I can get this to run within Matlab since your code works...
Couple more questions:
1) Will this 64bit value output the higher resolution I'm seeing on the overlaid Timestamp on images?
2) Are these values the start or mid-time of exposure? And are they when the frame was taking place or when the image was saved?

Thanks!
Tim

Posts: 1657
Joined: Sat Feb 11, 2017 3:52 pm
Location: Vale of the White Horse, UK
Contact:

### Re: Timestamp extraction

Hi Tim,

If you are using a modern operating system (Win8 onwards I think) then SharpCap uses the function GetSystemTimePreciseAsFileTime for frame timestamps, which has sub microsecond precision (but not necessarily similar accuracy). Earlier OS versions probably only have precision at the millisecond level or maybe even less than that. The timestamp is taken when the frame gets delivered by the camera SDK to SharpCap, so it's a point in time *after* the finish of the frame (probably by a fairly constant amount).

The option for better timing accuracy is to use one of the QHY GPS series cameras (these were the ones used with SharpCap to measure the occultation of 2014 MU69 earlier this year to get measurements of the object for the New Horizons probe). With the GPS cameras you can get the frame start and end times to microsecond accuracy if you are prepared to calibrate the GPS timing offsets when changing camera parameters.

cheers,

Robin

### Who is online

Users browsing this forum: No registered users and 1 guest