dc_datetime function documentation
Kristaps Dzonsons
kristaps at bsd.lv
Thu Jan 12 06:34:33 PST 2017
> Looks good, except for one thing:
>
>> The CAVEATS are important because calling gmtime et al from a library
>> might not be expected. (They touch the zoneinfo files, which may not be
>> available on embedded or sandboxed systems.)
>
> Why would that be unexpected? They are standard C library functions. I
> see no reason not to use them (and there are basically no easy
> alternatives). If their implementation is broken on some system, then
> that's a libc problem. So if you ask me, this caveats section is not
> necessary and only adds confusion.
Jef,
It's not that libc is broken w/r/t these functions, but it should be
noted that they're being used to specify how localtime is being computed.
(Why? First, because according to POSIX, localtime_r might invoke
tzset() beforehand, or it might not. Moreover, in chroots or in
capabilities environments, localtime might behave like gmtime due to
file-system restrictions.)
Perhaps this should be in an IMPLEMENTATION NOTES section instead of the
CAVEATS section, however, because it's not a bad thing --- just
clarification.
(For safety, it should also be noted in dc_parser_get_datetime that the
dc_datetime_localtime function might be invoked.)
I forgot to edit Makefile.am in my patch. If you'd like, I can rephrase
the CAVEAT as an IMPLEMENTATION NOTE and amend the Makefile.am in
another patch?
Best,
Kristaps
More information about the devel
mailing list