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
9bd9738d
Commit
9bd9738d
authored
Jan 18, 2020
by
Victor Zverovich
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove static and simplify names
parent
bd5f903f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
6 deletions
+6
-6
include/fmt/chrono.h
include/fmt/chrono.h
+6
-6
No files found.
include/fmt/chrono.h
View file @
9bd9738d
...
@@ -760,14 +760,14 @@ inline std::chrono::duration<Rep, std::milli> get_milliseconds(
...
@@ -760,14 +760,14 @@ inline std::chrono::duration<Rep, std::milli> get_milliseconds(
}
}
template
<
typename
Rep
,
typename
OutputIt
>
template
<
typename
Rep
,
typename
OutputIt
>
OutputIt
format_
chrono_
duration_value
(
OutputIt
out
,
Rep
val
,
int
precision
)
{
OutputIt
format_duration_value
(
OutputIt
out
,
Rep
val
,
int
precision
)
{
if
(
precision
>=
0
)
return
format_to
(
out
,
"{:.{}f}"
,
val
,
precision
);
if
(
precision
>=
0
)
return
format_to
(
out
,
"{:.{}f}"
,
val
,
precision
);
return
format_to
(
out
,
std
::
is_floating_point
<
Rep
>::
value
?
"{:g}"
:
"{}"
,
return
format_to
(
out
,
std
::
is_floating_point
<
Rep
>::
value
?
"{:g}"
:
"{}"
,
val
);
val
);
}
}
template
<
typename
Period
,
typename
OutputIt
>
template
<
typename
Period
,
typename
OutputIt
>
static
OutputIt
format_chrono
_duration_unit
(
OutputIt
out
)
{
OutputIt
format
_duration_unit
(
OutputIt
out
)
{
if
(
const
char
*
unit
=
get_units
<
Period
>
())
return
format_to
(
out
,
"{}"
,
unit
);
if
(
const
char
*
unit
=
get_units
<
Period
>
())
return
format_to
(
out
,
"{}"
,
unit
);
if
(
Period
::
den
==
1
)
return
format_to
(
out
,
"[{}]s"
,
Period
::
num
);
if
(
Period
::
den
==
1
)
return
format_to
(
out
,
"[{}]s"
,
Period
::
num
);
return
format_to
(
out
,
"[{}/{}]s"
,
Period
::
num
,
Period
::
den
);
return
format_to
(
out
,
"[{}/{}]s"
,
Period
::
num
,
Period
::
den
);
...
@@ -986,10 +986,10 @@ struct chrono_formatter {
...
@@ -986,10 +986,10 @@ struct chrono_formatter {
void
on_duration_value
()
{
void
on_duration_value
()
{
if
(
handle_nan_inf
())
return
;
if
(
handle_nan_inf
())
return
;
write_sign
();
write_sign
();
out
=
format_
chrono_
duration_value
(
out
,
val
,
precision
);
out
=
format_duration_value
(
out
,
val
,
precision
);
}
}
void
on_duration_unit
()
{
out
=
format_
chrono_
duration_unit
<
Period
>
(
out
);
}
void
on_duration_unit
()
{
out
=
format_duration_unit
<
Period
>
(
out
);
}
};
};
}
// namespace internal
}
// namespace internal
...
@@ -1088,8 +1088,8 @@ struct formatter<std::chrono::duration<Rep, Period>, Char> {
...
@@ -1088,8 +1088,8 @@ struct formatter<std::chrono::duration<Rep, Period>, Char> {
internal
::
handle_dynamic_spec
<
internal
::
precision_checker
>
(
internal
::
handle_dynamic_spec
<
internal
::
precision_checker
>
(
precision
,
precision_ref
,
ctx
);
precision
,
precision_ref
,
ctx
);
if
(
begin
==
end
||
*
begin
==
'}'
)
{
if
(
begin
==
end
||
*
begin
==
'}'
)
{
out
=
internal
::
format_
chrono_
duration_value
(
out
,
d
.
count
(),
precision
);
out
=
internal
::
format_duration_value
(
out
,
d
.
count
(),
precision
);
internal
::
format_
chrono_
duration_unit
<
Period
>
(
out
);
internal
::
format_duration_unit
<
Period
>
(
out
);
}
else
{
}
else
{
internal
::
chrono_formatter
<
FormatContext
,
decltype
(
out
),
Rep
,
Period
>
f
(
internal
::
chrono_formatter
<
FormatContext
,
decltype
(
out
),
Rep
,
Period
>
f
(
ctx
,
out
,
d
);
ctx
,
out
,
d
);
...
...
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