Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
F
fmt
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Libraries
fmt
Commits
7463c832
Unverified
Commit
7463c832
authored
Oct 19, 2021
by
Vladislav Shchapov
Committed by
GitHub
Oct 19, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix overflow for very bigger years (>2*10^9) (#2551)
parent
1266c2b6
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
6 deletions
+7
-6
include/fmt/chrono.h
include/fmt/chrono.h
+7
-6
No files found.
include/fmt/chrono.h
View file @
7463c832
...
...
@@ -1420,14 +1420,15 @@ template <typename OutputIt, typename Char> class tm_writer {
// Algorithm:
// https://en.wikipedia.org/wiki/ISO_week_date#Calculating_the_week_number_from_a_month_and_day_of_the_month_or_ordinal_date
auto
iso_year_weeks
(
const
int
curr_year
)
const
noexcept
->
int
{
const
int
prev_year
=
curr_year
-
1
;
const
int
curr_p
=
auto
iso_year_weeks
(
const
int
year
)
const
noexcept
->
int
{
const
long
long
curr_year
=
year
;
const
long
long
prev_year
=
curr_year
-
1
;
const
int
curr_p
=
static_cast
<
int
>
(
(
curr_year
+
curr_year
/
4
-
curr_year
/
100
+
curr_year
/
400
)
%
days_per_week
;
const
int
prev_p
=
days_per_week
)
;
const
int
prev_p
=
static_cast
<
int
>
(
(
prev_year
+
prev_year
/
4
-
prev_year
/
100
+
prev_year
/
400
)
%
days_per_week
;
days_per_week
)
;
return
52
+
((
curr_p
==
4
||
prev_p
==
3
)
?
1
:
0
);
}
auto
iso_week_num
(
int
tm_yday
,
int
tm_wday
)
const
noexcept
->
int
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment