Commit Graph

85 Commits

Author SHA1 Message Date
Victor Zverovich
e475859042 Fix overspecified tests 2023-07-20 14:09:22 -07:00
Patrick Geltinger
d7592ad8bf
Fix time_point formatting for durations with certain ratios (#3430)
* Fix time_point formatting

* Add timestamps_ratios tests
2023-05-11 15:25:21 -07:00
Vladislav Shchapov
f6276a2c2b
Force use a signed char (On ARM char is unsigned by default) (#3362)
Signed-off-by: Vladislav Shchapov <vladislav@shchapov.ru>
2023-03-22 11:34:59 -07:00
Barry Revzin
93bfa05382
%T is %H:%M:%S (#3349) 2023-03-18 07:16:22 -07:00
Shawn Zhong
7718eeeacc
Implement glibc ext for sec, min, and hour (#3271) 2023-02-08 09:22:58 -08:00
Shawn Zhong
dfbb952b2c
Fix empty spec for time point (#3275) 2023-01-16 11:48:00 -08:00
Shawn Zhong
676c2a107e
Fix negative subsec for time_point (#3261) 2023-01-11 11:36:50 -08:00
Shawn Zhong
dda53082be
Support fill, align & width for time point (#3260) 2023-01-09 11:25:31 -08:00
Vladislav Shchapov
4841784e82 Simplify C99 strftime detection conditions
Signed-off-by: Vladislav Shchapov <vladislav@shchapov.ru>
2022-12-25 10:16:19 -08:00
Vladislav Shchapov
cb72c23e9e Improve timezone tests
Signed-off-by: Vladislav Shchapov <vladislav@shchapov.ru>
2022-12-25 10:16:19 -08:00
Shawn Zhong
8c56919bd2 Check chrono spec starts with % 2022-12-21 14:40:30 -08:00
Niall Douglas (s [underscore] sourceforge {at} nedprod [dot] com)
115001a3b1 Formatting of system clocks ought to be to UTC, not to local time.
This improves standards conformance of fmt.
2022-12-21 14:23:02 -08:00
Vladislav Shchapov
1bf302a4ea Implement %Ez, %Oz for chrono formatter
Signed-off-by: Vladislav Shchapov <vladislav@shchapov.ru>
2022-12-10 10:13:53 -08:00
Stepan Ponomaryov
795ed8abf5
Add precision modifier for seconds in chrono format (#3148)
Co-authored-by: Stepan Ponomarev <stepan.ponomarev@itiviti.com>
2022-11-02 11:58:51 -07:00
Vladislav Shchapov
cd7202e039
Fix overflow error (#3143)
Signed-off-by: Vladislav Shchapov <vladislav@shchapov.ru>

Signed-off-by: Vladislav Shchapov <vladislav@shchapov.ru>
2022-10-16 14:04:55 -07:00
Patrick Roocks
9254cfa6f0
Support formatting of subseconds (#3115)
* Timestamp formatting shall print also subseconds, fixed a bug for fractional durations
2022-10-12 14:33:53 -07:00
Patrick Roocks
ad719619cc
Support formatting of std time_point with utc_clock (#3110) 2022-09-28 07:31:53 -07:00
Dimitrij Mijoski
fc23cfbf4e Fix testsuite on MinGW + MSVCRT
Fixes #2952. The testsuite indirectly called strftime() with conversion
specifiers defined only in C99. In MSVCRT this function conforms only to
C89. Only in the updated UCRT this functon provides the functionality of
C99.
2022-08-14 08:40:38 -07:00
matrackif
5985f0a7d2
Fix overflow for chrono durations (#2722) 2022-01-17 12:14:59 -08:00
Victor Zverovich
d9f045fba1 Fix a UB in chrono 2022-01-09 14:06:13 -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
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
lukester1975
12b1d8b14a
Fix precision 0 with std::chrono::duration and added additional tests. (#2588) 2021-11-06 08:57:22 -07:00
Victor Zverovich
5b0aa638cf Minor grammar fix 2021-10-30 09:14:13 -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
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
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
5dc3dd3d4a New tests 2021-10-16 15:03:57 -07:00
Vladislav Shchapov
4707373d33 Fix year formatter 2021-10-16 15:03:57 -07:00
Vladislav Shchapov
79c00ad8f2 Improve ISO week-base-year formatter 2021-10-16 15:03:57 -07:00
Vladislav Shchapov
cde44ddb72 Improve year formatter 2021-10-16 15:03:57 -07:00
Vladislav Shchapov
b04601b918 Switch from std::strftime/std::wcsftime to internal implementation for locale independent formats 2021-10-16 15:03:57 -07:00
Vladislav Shchapov
d3d30a46f0 New tests 2021-10-16 15:03:57 -07:00
Vladislav Shchapov
509eac9575 Workarounds for implementation-defined std::strftime behavior 2021-10-16 15:03:57 -07:00
Vladislav Shchapov
85b38190d1 New tests for all C++11 std::strftime format specifiers 2021-10-16 15:03:57 -07:00
Vladislav Shchapov
92614ecbf9 Optimize %T in tm formatting 2021-09-15 07:33:24 -07:00
Victor Zverovich
67cb2dad37 Optimize %F in tm formatting 2021-09-10 07:48:50 -07:00
sunmy2019
f28cf3302d
adding a default format for std::chrono::time_point<std::chrono::syst… (#2345) 2021-06-11 10:52:39 -07:00
Владислав Щапов
f6b5cc9f84 Fix chrono_test.weekday on legacy glibc 2021-06-10 16:17:10 -07:00
Victor Zverovich
76ee490468 Move wchar/custom char overloads to xchar.h 2021-06-05 22:57:45 -07:00
Victor Zverovich
35a2c2a743 Refactor chrono formatting 2021-05-25 06:57:47 -07:00
Victor Zverovich
1cd9899cf3 Add initial support for weekday formatting 2021-05-24 10:21:34 -07:00
Victor Zverovich
e9c1c415b8 Improve compile-time checks 2021-05-19 07:57:57 -07:00
Victor Zverovich
d0abe7c246 Make chrono formatting locale-independent by default 2021-05-07 16:14:10 -07:00
Victor Zverovich
38127d9ec0 Cleanup tests 2021-04-30 15:50:03 -07:00