On Tue, 13 Jul 2021 at 21:42, Carlos O'Donell wrote: > (1) Missing files vs. No /usr/share/zoneinfo. > > All existing third-party software must handle zone name changes today, > so there must be some way to handle the error that a given zone is > missing (changed names). > > Let me talk a bit about the new C++ time zone API I have been looking > at with Jonathan Wakely. > > Errors based on this will be likely correct e.g. get_tz_dir() from the > currently proposed C++ API for this (see (2)): N.B. The functions below are not part of the standardized API, they are implementation details of a specific implementation of that API. > > 353 CONSTDATA auto tz_dir_default = "/usr/share/zoneinfo"; > 354 CONSTDATA auto tz_dir_buildroot = "/usr/share/zoneinfo/uclibc"; > 355 > 356 // Check special path which is valid for buildroot with uclibc builds > 357 if(stat(tz_dir_buildroot, &sb) == 0 && S_ISDIR(sb.st_mode)) > 358 return tz_dir_buildroot; > 359 else if(stat(tz_dir_default, &sb) == 0 && S_ISDIR(sb.st_mode)) > 360 return tz_dir_default; > 361 else > 362 throw runtime_error("discover_tz_dir failed to find zoneinfo\n"); > > Having tzdata uninstalled will throw the generic error as on line 362. > > But having tzdata-minimal will instead throw a specific error from line 3624: > > 3624 throw std::runtime_error(std::string(tz_name) + " not found in timezone database"); > > This probably supports having tzdata removed entirely, since the latter > error makes it seems as-if the zone name is wrong (it's not, it's just > not installed). > > Notes: > https://github.com/HowardHinnant/date > > (2) Non-rpm packaging. > > We have C++ users using Howard Hinnart's 'date' package that implements > <chrono> header and it can process complete IANA tzdb files. > > Currently Howard's API is being proposed for inclusion > http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2018/p0355r7.html N.B. This is incorrect, it was proposed some years ago (the paper above is from 2018) and is now part of ISO/IEC 14882:2020 i.e. the C++20 standard. I'm not yet sure what the C++ runtime will need to do if there are no zoneinfo files at all, not even UTC. I suspect we will need a fallback to UTC as well, and std::tzdb::current_zone() will return the info for the UTC timezone. So I'm not sure that there's much practical difference between no tzdata at all and tzdata-minimal as far as libstdc++ will be concerned. This might change once I actually start to implement it though. Maybe having tzdata-minimal would allow the initial implementation to omit the fallback (assuming that all sensible linux environments have at least UTC info), and add the fallback later. (It doesn't help that glibc has a fallback to UTC because the C++ runtime can't use glibc for timezone info, it will consume the tzdata files directly.) _______________________________________________ devel mailing list -- devel@xxxxxxxxxxxxxxxxxxxxxxx To unsubscribe send an email to devel-leave@xxxxxxxxxxxxxxxxxxxxxxx Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/ List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines List Archives: https://lists.fedoraproject.org/archives/list/devel@xxxxxxxxxxxxxxxxxxxxxxx Do not reply to spam on the list, report it: https://pagure.io/fedora-infrastructure