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

Thiago Macieira thiago at macieira.org
Thu May 9 08:56:05 PDT 2013


On quinta-feira, 9 de maio de 2013 08.09.51, Dirk Hohndel wrote:
> On Thu, 2013-05-09 at 09:50 +0300, Miika Turkia wrote:
> > It appears that Windows returns NULL when converting DM4 database's date
> > stamps to local time. (This is due to DM4 using time since year 1, not
> > epoch and Windows doing "sanity checking" on the time.)
> > 
> > This patch moves the conversion of time format directly to database
> > query so the localtime should function on Windows. It will also fail
> > gracefully in case of NULL (with error message: failed to parse input).
> > 
> > Signed-off-by: Miika Turkia <miika.turkia at gmail.com>
> > ---
> > +	/*
> > +	 * I am not sure about the timezones when it comes to Suunto
> > +	 * DM4. However, with a sample on GMT+2 and another in GMT+1
> > +	 * this code seems to work.
> > +	 * Remaining question is, how to handle daylight savings.
> > +	 * (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...
> (not sure about Mac)

It does on Mac:

$ grep gmtoff /usr/include/time.h
        long    tm_gmtoff;      /* offset from CUT in seconds */

-- 
Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
   Software Architect - Intel Open Source Technology Center
      PGP/GPG: 0x6EF45358; fingerprint:
      E067 918B B660 DBD1 105C  966C 33F5 F005 6EF4 5358
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 190 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.hohndel.org/pipermail/subsurface/attachments/20130509/92578650/attachment.sig>


More information about the subsurface mailing list