Commit Graph

5640 Commits

Author SHA1 Message Date
Victor Zverovich
91533d3c33 Minor tweaks to chrono subsecond formatting 2021-12-09 06:55:31 -08:00
matrackif
0bbc9708f9
Implement c++20 std::chrono::duration subsecond formatting (#2623)
* Add support for subsecond printing for std::chrono::duration according to the c++20 standard

* Remove assert test that overflows intmax_t

* * Hopefully fix int64_t to int32_t conversion errors.
* Allow proper Duration::rep type to propagate via template argument deduction

* * Hopefully fix int64_t to int32_t conversion errors.
* Allow proper Duration::rep type to propagate via template argument deduction

* Fix sign conversion (-Wsign-conversion) warning treated as error in num_digits()

* Format chrono.h with clang-format

* Remove extra forward slash in doxygen style comment

Co-authored-by: Victor Zverovich <victor.zverovich@gmail.com>

* Apply all suggestions from GitHub, except for replacing the utility subsecond_helper class with a function

* * Move logic of handling subseconds from utility class to function with name write_fractional_seconds()
* Revert write(Rep value, int width) function to previous state

* Fix -Wshadow warning

* Remove unsued get_subseconds() function, its logic has been moved to write_fractional_seconds()

* Change comment from lowercase int to uppercase Int

* Simplify test check

* Integrate suggested changes

* Remove static from detail functions, they are no longer member functions of a class and static is unnecessary.
* Change comment from "amount" to "number"

Co-authored-by: Victor Zverovich <victor.zverovich@gmail.com>
2021-12-09 06:45:13 -08:00
Vladislav Shchapov
9d5b9defde
Enable tzset only on Windows desktop app (#2633) 2021-12-07 15:22:36 -08:00
Victor Zverovich
215f21a038 Detect overflow on large precision 2021-12-05 07:26:58 -08:00
Vladislav Shchapov
c240d98ffd
Optimize tm formatting (Non C-locales and %Z) (#2617)
* Move fmt::detail::formatbuf to format.h

* Replace std::basic_ostringstream to std::basic_ostream with custom formatbuf

* Use tm.tm_zone
2021-12-04 11:02:31 -08:00
Andrew Corrigan
6ab73113fc
Mark grow as FMT_CONSTEXPR20 (#2630)
resolves https://github.com/fmtlib/fmt/issues/2627
2021-12-03 07:13:30 -08:00
Victor Zverovich
713c7c7c62 Cleanup os.cc 2021-12-01 06:47:41 -08:00
Acretock
9b1807a8a2
fix int -> uint warning (#2611)
* fix int -> uint warning

* change unsigned int to mode_t

* undef + warn uint -> ushort loss presision

* fix mode_t

* mode_t in detail

Co-authored-by: Acretock <George.Goncharov@finch-xr.com>
2021-12-01 06:40:17 -08:00
Lounarok
ec3b097cb9
[doc] FMT_STRING supports C++14 and no-op in C++11 (#2620)
* FMT_STRING supports C++14 and no-op in C++11

* Move requirement to the end. Modify description.
2021-11-28 07:02:15 -08:00
Victor Zverovich
c472a27818 Fix handling of very large precision in fixed format 2021-11-27 08:23:05 -08:00
Alex Guteniev
201971e293
Make MSVC use [[nodiscard]] (#2615)
* Make MSVC use [[nodiscard]]
* Uniformly detect attributes for __cplusplus and _MSVC_LANG
2021-11-26 07:32:50 -08:00
Florin Iucha
acad8cfab1 Reformat all source code; no functional changes
Before adding the format checker, the mainline should be clean, to
avoid false failures.
2021-11-25 09:15:25 -08:00
Florin Iucha
491ba2dda5 Annotate fmt::format and fmt::formatted_size as [[nodiscard]]
This prevents accidentally writing fmt::format when fmt::print was
intended. Other than running tests, there's not a good use case for
discarding the formatted output.
2021-11-25 07:30:30 -08:00
Vladislav Shchapov
5abe9e8266 Add platform-specific 'z' formatter 2021-11-25 06:52:39 -08:00
Vladislav Shchapov
be3a3a5aed Use predefined formats for C-locale 2021-11-25 06:52:39 -08:00
Alex Guteniev
a3ab36c803
Formatting of function pointers, member function pointers, member object pointers... (#2610) 2021-11-23 12:55:22 -08:00
Eric Curtin
19cac63fe4 Broken link in README.rst
Added src directory to link
2021-11-19 09:24:38 -08:00
Victor Zverovich
43419a4ada Workaround a bug in gcc 2021-11-19 07:32:42 -08:00
Vladislav Shchapov
c089f7d497 Simplify std::tm formatter 2021-11-14 07:16:22 -08:00
Vladislav Shchapov
aa5517f6b9 Reuse tm_writer in chrono_formatter 2021-11-14 07:16:22 -08:00
Vladislav Shchapov
50140be7ae Reuse tm_writer in weekday formatter 2021-11-14 07:16:22 -08:00
Victor Zverovich
8b89454994 Improve consistency 2021-11-13 08:59:56 -08:00
Victor Zverovich
5380ff4d88 Detect types convertible to unformattable pointers 2021-11-13 08:26:27 -08:00
Pavel Novikov
094b66e81d changed locale retrieval way to a fancy one 2021-11-12 12:46:38 -08:00
Vladislav Shchapov
b69ae4854c
Reorder classes (#2591) 2021-11-10 17:09:23 -08:00
Pavel Novikov
0b843af56b
sped up chrono.h formatting for cases without providing locale (#2576) 2021-11-07 08:52:57 -08:00
lukester1975
12b1d8b14a
Fix precision 0 with std::chrono::duration and added additional tests. (#2588) 2021-11-06 08:57:22 -07:00
Olli Lupton
e67f92c55c
Cleanup warnings with nvhpc/21.9. (#2582)
* Cleanup warnings with nvhpc/21.9.

* Move __NVCOMPILER check.

* Be more explicit.

* Immediately executed lambda.

* Fix shadowing warning.
2021-11-05 12:17:11 -07:00
Victor Zverovich
812733cc96 const qualify format function for systen_clock 2021-10-31 09:41:16 -07:00
Victor Zverovich
028f227752 Handle implicit conversions in write 2021-10-31 08:58:54 -07:00
Victor Zverovich
5b0aa638cf Minor grammar fix 2021-10-30 09:14:13 -07:00
Vladislav Shchapov
6eaceb5f73
Fix incompatible between docutils 1.18.0 and sphinx 3.3.0 (#2575) 2021-10-30 09:12:36 -07:00
timkalu
0697c5edb6
FMT_USE_FCNTL can be predefined (#2573)
'os.h' accepts a predefined FMT_USE_FCNTL override so using FMT with e.g. the NXP toolchain for ARM (e.g. for FreeRTOS) does not have a fcntl() call, but the detection routine does not detect this correctly.
2021-10-30 08:35:48 -07:00
Vladislav Shchapov
1031eedf27
Replacing strftime with std::time_put (#2550)
* Fix unicode test

* Add xchar support to chrono formatter

* Replace strftime with std::time_put

* Add std::locale support to std::tm formatter

* Use predefined names and formats for C-locale

* Performance improvement

* Make locale-independent and C locale formats consistent among platforms
2021-10-30 08:25:45 -07:00
Vladislav Shchapov
90034e4c4b
Add FMT_ASSERT and validation of values of struct tm members (#2564)
Switch internal year calculations to long long
2021-10-27 13:29:07 -07:00
Daniela Engert
df40e94673
Upgrade module-test to msvc 16.11.5 and 17.0-pre5 (#2558) 2021-10-24 08:12:39 -07:00
zhsj
e6d5059cbb
Simplify js tag in basic-bootstrap theme (#2562)
When build the docs for debian package, it uses a sphinx building
helper, which does a sanity check for the output.

The sanity check complains missing data-url_root attribute in the
js tag. So this patch changes the js tag to use the same function like
the origin basic theme, which adds additional information like
data-url_root.

Ref: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=997437
2021-10-24 06:36:10 -07:00
Daniela Engert
3b6e409cd8
Enable consteval for msvc 17.0-pre5 (#2559) 2021-10-23 07:19:57 -07:00
Axel Kohlmeyer
249f03bbb7
do not detect LLVM based IBMXL compiler (on ppc) as clang (#2555) 2021-10-20 06:21:49 -07:00
Vladislav Shchapov
7463c83205
Fix overflow for very bigger years (>2*10^9) (#2551) 2021-10-19 07:04:55 -07:00
Victor Zverovich
1266c2b600 Fix handling of exotic character types 2021-10-17 09:07:48 -07:00
Victor Zverovich
684e2fdc94 Minor cleanup 2021-10-17 06:33:27 -07:00
Victor Zverovich
a1d586302f Minor cleanup 2021-10-17 06:07:03 -07:00
Vladislav Shchapov
7a604cdd98 Cleanup 2021-10-16 15:03:57 -07:00
Vladislav Shchapov
aeb54b0dd9 Fix bug on '%Y' and '%C' formats with negative years
Requested changes
2021-10-16 15:03:57 -07:00
Vladislav Shchapov
f88c020fc0 Generalization of strftime/wcsftime function calls in tests 2021-10-16 15:03:57 -07:00
Vladislav Shchapov
2eeddba756 Renaming, splitting of functions 2021-10-16 15:03:57 -07:00
Vladislav Shchapov
2754546080 Fix errors in ISO week-base-year formatter 2021-10-16 15:03:57 -07:00
Vladislav Shchapov
218cecb6d1 Fix error in test 2021-10-16 15:03:57 -07:00
Vladislav Shchapov
e9f4453b0e Fix Microsoft Visual Studio 14.0 build 2021-10-16 15:03:57 -07:00