PlistCpp
PlistCpp copied to clipboard
How do I set the precision at which doubles are saved?
I am saving time as seconds since epoch using doubles. For my admittedly old version of PlistCpp it saves as
<real>1.39531e+09</real>
How do I increase its precision? Or do I have no choice but to change to longs? This would break compatibility.
Hi,
If you can use binary plists I think it will just work as it will get written with double precision. For XML take a look at the function stringFromValue in Plist.cpp and see the accepted answer at the following stack overflow: http://stackoverflow.com/questions/12894824/double-and-stringstream-formatage for setting the precision of stringstream. Let me know how it goes.
Thanks, I will try it out. I thought it might have exposed an interface for setting the precision that I missed, which is why I asked.
Binary happens to be too slow on the Android devices I am working on.