[PATCH] Use gtk_tree_model_get_value() to get the index and date of a dive

Lubomir I. Ivanov neolit123 at gmail.com
Wed Sep 19 01:10:40 PDT 2012


On 19 September 2012 10:32, Jef Driesen <jefdriesen at telenet.be> wrote:
> Windows doesn't have gmtime_r, but the msvcrt runtime library uses
> thread-local storage and thus the gmtime function is thread-safe (assuming
> you don't keep the pointer to the returned struct tm, and copy the struct to
> a local variable instead). There is also the _gmtime_s function on Windows.
>
> For libdivecomputer I just made a wrapper function that calls gmtime_r when
> available (linux, macosx) and falls back to plain gmtime. The result should
> be thread-safe on all three platforms.
>
> Jef

mingw-gcc 4.7, mingw-gcc 4.8 provides some of these in time.h as
macros under POSIX (which is what they are):

#ifndef gmtime_r
#define gmtime_r(_Time,_Tm)	({ struct tm *___tmp_tm =		\
						gmtime((_Time));	\
						if (___tmp_tm) {	\
						  *(_Tm) = *___tmp_tm;	\
						  ___tmp_tm = (_Tm);	\
						}			\
						___tmp_tm;	})
#endif

but i would rather write this as a locally defined macro or use
something like you do in libdivecomputer, because i really want use to
target older compilers on windows.
lubomir
--


More information about the subsurface mailing list