-
Notifications
You must be signed in to change notification settings - Fork 687
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Exactly how is this different from the C++20 version? #565
Comments
Keep this issue open until I get it documented so that others can find this information more easily. Differences between this library and C++20:
std::string s = date::format("%F %T", tp); one would say: std::string s = std::format("{:%F %T}", tp);
auto zt = make_zoned(current_zone(), system_clock::now()); one writes: zoned_time zt{current_zone(), system_clock::now()};
auto tod = make_time(tp-sd); one writes: hh_mm_ss tod{tp-sd};
bool remote_download(const std::string& version);
bool remote_install(const std::string& version);
void set_install(const std::string& s); Your vendor is responsible for keeping the time zone database up to date, and may or may not have the feature of being able to update the database while your application is running. |
Excellent summary, thanks! Is this library's |
Thanks, I incorrectly assumed the standard |
Other differences:
|
Actually |
I have unit tests that depend on running against deterministic versions of the TZ database. Currently I use the The next best thing would be the ability to freeze the TZ DB version at a known point, to get reproducible builds. Does the C++20 library specification guarantee that freezing the vendor-supplied library at a specific version will also freeze the TZ DB version? Or is the vendor-supplied library allowed to pickup whatever TZ DB version happens to be installed and upgraded on the host OS? Finally, will the C++20 library provide the same TZ DB metadata info that is documented here (https://howardhinnant.github.io/date/tz.html#database)? struct tzdb
{
string version;
vector<time_zone> zones;
vector<link> links;
vector<leap> leaps;
const time_zone* locate_zone(string_view tz_name) const;
const time_zone* current_zone() const;
}; |
The C++20 spec does not specify when or how often the vendor will upgrade the TZ DB. On some platforms (e.g. macOS) I expect one to have to install an OS patch (with subsequent reboot) to get an upgraded TZ DB. On Linux I expect it will be possible to upgrade the TZ DB while applications are running. I do not know if Linux asks for an admin ok prior to doing so (I would hope so). In any event, upgrading the installed TZ DB is likely to be an OS-driven event as opposed to a C++ tools driven event. Yes, That being said, because of the way the IANA zic compiler processes links, it may be that Also (and as noted above, but could be clearer), the names of some of these members has been slightly changed (e.g. |
FYI: On Debian/Ubuntu/Mint, the TZ DB is in the tzdata APT package which normally needs an admin ok when updating. Reboots are not necessary when updating a non-kernel package. It's possible to set-up auto updating on a regular basis (e.g. daily) where no user intervention is necessary. |
Differences in the
|
One difference I noticed recently is the |
besides other differences in format string syntax (such as say leading "{:" and trailing "}") there's requirement that "A chrono-spec must start with a conversion specifier" and despite of "All ordinary characters are written to the output without modification" std::format won't let to use leading ordinary characters as date::format allowed |
The literal operators also are different and are Lines 1968 to 1987 in 1ead671
|
I would like to keep using this library as a "fallback" for compilers that don't yet support C++20's new date facilities. I need to know exactly what's different between this version and the C++20 version (from an API standpoint) so that I can use preprocessor directives accordingly.
It would be useful to have a summary of differences documented somewhere.
The text was updated successfully, but these errors were encountered: