Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
A
Actor Framework
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
Operations
Operations
Metrics
Environments
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
cpp-libs
Actor Framework
Commits
7c523501
Commit
7c523501
authored
Sep 10, 2018
by
Dominik Charousset
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Simplify render_date
parent
96985a44
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
2 additions
and
8 deletions
+2
-8
libcaf_core/src/logger.cpp
libcaf_core/src/logger.cpp
+1
-7
libcaf_core/test/logger.cpp
libcaf_core/test/logger.cpp
+1
-1
No files found.
libcaf_core/src/logger.cpp
View file @
7c523501
...
@@ -348,13 +348,7 @@ void logger::render_time_diff(std::ostream& out, timestamp t0, timestamp tn) {
...
@@ -348,13 +348,7 @@ void logger::render_time_diff(std::ostream& out, timestamp t0, timestamp tn) {
}
}
void
logger
::
render_date
(
std
::
ostream
&
out
,
timestamp
x
)
{
void
logger
::
render_date
(
std
::
ostream
&
out
,
timestamp
x
)
{
auto
y
=
std
::
chrono
::
time_point_cast
<
timestamp
::
clock
::
duration
>
(
x
);
out
<<
deep_to_string
(
x
);
auto
z
=
timestamp
::
clock
::
to_time_t
(
y
);
// strftime workaround: std::put_time not available on GCC 4.8
// out << std::put_time(std::localtime(&z), "%F %T");
char
buf
[
50
];
if
(
strftime
(
buf
,
sizeof
(
buf
),
"%Y-%m-%d %H:%M:%S"
,
std
::
localtime
(
&
z
)))
out
<<
buf
;
}
}
void
logger
::
render
(
std
::
ostream
&
out
,
const
line_format
&
lf
,
void
logger
::
render
(
std
::
ostream
&
out
,
const
line_format
&
lf
,
...
...
libcaf_core/test/logger.cpp
View file @
7c523501
...
@@ -106,7 +106,7 @@ CAF_TEST(rendering) {
...
@@ -106,7 +106,7 @@ CAF_TEST(rendering) {
time_t
t0_t
=
0
;
time_t
t0_t
=
0
;
char
t0_buf
[
50
];
char
t0_buf
[
50
];
CAF_REQUIRE
(
strftime
(
t0_buf
,
sizeof
(
t0_buf
),
CAF_REQUIRE
(
strftime
(
t0_buf
,
sizeof
(
t0_buf
),
"%Y-%m-%d
%H:%M:%S
"
,
localtime
(
&
t0_t
)));
"%Y-%m-%d
T%H:%M:%S.000
"
,
localtime
(
&
t0_t
)));
CAF_CHECK_EQUAL
(
render
(
logger
::
render_date
,
t0
),
t0_buf
);
CAF_CHECK_EQUAL
(
render
(
logger
::
render_date
,
t0
),
t0_buf
);
// Rendering of events.
// Rendering of events.
logger
::
event
e
{
logger
::
event
e
{
...
...
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