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

Dirk Hohndel dirk at hohndel.org
Thu May 9 08:09:51 PDT 2013


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)

/D



More information about the subsurface mailing list