<html>
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<div class="moz-cite-prefix">On 2015-04-05 16:25, Even Rouault
wrote:<br>
</div>
<blockquote cite="mid:201504052125.53531.even.rouault@spatialys.com"
type="cite">
<pre wrap=""> struct {
GInt16 Year;
GByte Month;
GByte Day;
GByte Hour;
GByte Minute;
GByte TZFlag;
GByte Precision; /* value in OGRDateTimePrecision */
float Second; /* from 00.000 to 60.999 (millisecond accuracy) */
} Date;</pre>
</blockquote>
If it's not too different from what exists, I have found that a good
general solution is what Unix uses:<br>
<br>
<tt>struct {</tt><tt><br>
</tt><tt> GInt64 second;</tt><tt> /* assuming GInt64 and
GUInt32 types exist */<br>
</tt><tt> GUInt32 nanosecond;</tt><tt><br>
</tt><tt>} Date;</tt><br>
<br>
<div class="moz-signature">This representation is good for nearly
300-billion years with uniform resolution of one nanosecond.
Don't take the evolutionary path of repeatedly discovering that
you don't have enough precision and just jump straight to
nanoseconds. Time zones don't matter either; just represent
everything in UTC and display it in the local time zone of the
client (using POSIX localtime_r() which is compatible with this
representation). Parsing strings isn't a big problem either; I've
written code that can parse a packed-digit string like
"20150405193638" into this structure in 27 nanoseconds on a
computer that is several years old (by comparison, a simple string
copy of the same string takes 25 nanoseconds). Date arithmetic and
comparison is also very simple. You can add the 'Precision' field
if you need it.<br>
<br>
-- <br>
Dr. Craig S. Bruce
<br>
Senior Software Developer
<br>
CubeWerx<i> </i>Inc.</div>
</body>
</html>