[PATCH] Attempt to fix a crash on DM4 Windows import
Miika Turkia
miika.turkia at gmail.com
Thu May 9 11:00:04 PDT 2013
On Thu, May 9, 2013 at 8:47 PM, Dirk Hohndel <dirk at hohndel.org> wrote:
> On Thu, 2013-05-09 at 20:45 +0300, Miika Turkia wrote:
>
> > >> + * (Samples I have are contradicting each
> > other...)
> > >> + */
> > >> + tm->tm_hour += tm->tm_gmtoff / 3600;
> > >> + tm->tm_min += tm->tm_gmtoff % 3600;
> > >
> > > tm_gmtoff is an extension that I believe does not
> > exist on Windows...
> > >
> >
> >
> >
> http://www.gnu.org/software/libc/manual/html_node/Broken_002ddown-Time.html
> > "The tm_gmtoff field is derived from BSD and is a GNU
> > library
> > extension; it is not visible in a strict ISO C
> > environment. "
> > yes, it's not available...not that Windows is a
> > "strict ISO C environment."
> >
> > i think this should give a similar result:
> > time_t raw = time(NULL);
> > time_t tm_gmtoff = mktime(localtime(&raw)) -
> > mktime(gmtime(&raw));
> >
> >
> > This does indeed do the trick. However, testing this again seems to be
> > giving me wrong times. I guess I will have to try to decipher the DM4
> > time format again. A sample with e.g. US time zone would be nice for
> > this exercise. DB dump and clear-text dive log to make sure what the
> > time should be.
>
> Can I ask you for a two-step process?
>
> Can you send a patch that stops the crash. Then a second one that fixes
> the time?
>
> Sure thing. The patch I just sent should do the trick. Timezones are not
handled properly but at least we should see if it works on Windows.
miika
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.hohndel.org/pipermail/subsurface/attachments/20130509/4886b762/attachment.html>
More information about the subsurface
mailing list