09-14-2010 02:08 AM
Hi all,
I am saving binary data during a RT application and want to post-convert it into ascii. I am considering using sgl representation for the saved data to reduce file size. However, using sgl means that the timestamp gets "chopped" (i.e. one gets only up to minutes in time, no secs and millisecs). So, I was wondering if there is anyway to either
a) Get the full timestamp information from an sgl number (i.e. using the number to timestamp vi..)
or
b) When saving a timestamp, is there any way to skip the date part (unnessecary in my case)? I ask that assuming that if I could skip the date part then an sgl representation would be enough to give me up to milliseconds..
Thanks for your time,
Harry
Solved! Go to Solution.
09-14-2010 02:55 AM
A timestamp uses 64 bits to hold the number of seconds since 1,1,1904 and another 64 bits to hold the fraction of the current second. You can't get anywhere near that with the 32 bits that SGL gives you and you can't "skip" the date, because it's an integral part of the number.
One thing you can do is create a new epoch instead of 1904, but if you take 10 bits to get the ms resoution, that would leave you with 22 bits for the seconds, which isn't very long.
What you can do is this:
This should be good for roughly 50 days of measurements, after which the tick count rolls over.
There are probably also existing formats where you configure this, but I have no experience with that.
09-14-2010 03:14 AM
09-14-2010 03:22 AM
Thanks tst,
nice trick there. I am sure it will give me what I want, and obviously 50 days of measurements is certainly enough...!!!
Cheers,
Harry