[PATCH] Use gtk_tree_model_get_value() to get the index and date of a dive
Jef Driesen
jefdriesen at telenet.be
Wed Sep 19 00:32:56 PDT 2012
On 2012-09-19 02:19, Dirk Hohndel wrote:
>> "gmtime_r" not so much for a standalones with linear code. would be
>> worth a shot, somehow...
>
> I was worried about compatibility (Windows, Mac), I haven't checked
> if
> they both support this. In general switching to gmtime_r shouldn't
> cause
> any harm.
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
More information about the subsurface
mailing list