A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/fmtlib/fmt/issues/3282 below:

fmt chrono fails for clock minimum value · Issue #3282 · fmtlib/fmt · GitHub

https://godbolt.org/z/GbbvMb3bE

    #include <iostream>
    #include <chrono>
    #include <fmt/format.h>
    #include <fmt/chrono.h>
    
    int main(void)
    {
        // OK:
        // auto t = std::chrono::system_clock::time_point::max();
        // failure:
        auto t = std::chrono::system_clock::time_point::min();
        fmt::print("{}\n", t);
        return 0;
    }

Result:

    terminate called after throwing an instance of 'fmt::v9::format_error'
      what():  duration is too small

Code in chrono.h:2113 explicitly checks for one second above min() and fails for value= min(). For max(), works OK. Until recently, it worked fine for min(). This commit: 240b728 added the offending code. I'm not sure about the intent of this test. I discovered the issue, because one of my tests started to fail. min() value seems to be legal value, albeit used not too often.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4