[PATCH] Attempt to fix a crash on DM4 Windows import

Dirk Hohndel dirk at hohndel.org
Thu May 9 10:47:42 PDT 2013


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?

Thanks

/D




More information about the subsurface mailing list