Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
N
nx-libs
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
1
Issues
1
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
dimbor
nx-libs
Commits
fc4a18d3
Commit
fc4a18d3
authored
Jun 30, 2017
by
Mihai Moldovan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
nxcomp/{configure.ac,Log.cpp}: implement configure-time std::put_time check and…
nxcomp/{configure.ac,Log.cpp}: implement configure-time std::put_time check and use macro value in Log.cpp.
parent
67b0a17f
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
1 deletion
+19
-1
configure.ac
nxcomp/configure.ac
+17
-0
Log.cpp
nxcomp/src/Log.cpp
+2
-1
No files found.
nxcomp/configure.ac
View file @
fc4a18d3
...
@@ -74,6 +74,23 @@ AC_ARG_ENABLE([cxx11],
...
@@ -74,6 +74,23 @@ AC_ARG_ENABLE([cxx11],
[AS_IF([test x$enableval = xyes],
[AS_IF([test x$enableval = xyes],
[AX_CXX_COMPILE_STDCXX_11([], [mandatory])])])
[AX_CXX_COMPILE_STDCXX_11([], [mandatory])])])
# Check if std::put_time is available.
AC_MSG_CHECKING([if std::put_time is available])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
[[
#include <iomanip>
#include <ctime>
]],
[[
std::time_t t = std::time(NULL);
std::tm tm = *std::localtime(&t);
(void) std::put_time(&tm, "%c");
]])],
[AC_MSG_RESULT([yes])
AC_DEFINE(HAVE_STD_PUT_TIME, [1],
[Use std::put_time to format times, must be made available by the compiler if turned on.])],
[AC_MSG_RESULT([no])])
AC_ARG_ENABLE([debug],
AC_ARG_ENABLE([debug],
[AS_HELP_STRING([--enable-debug],
[AS_HELP_STRING([--enable-debug],
[enable to get info session log output (disabled by default)])],
[enable to get info session log output (disabled by default)])],
...
...
nxcomp/src/Log.cpp
View file @
fc4a18d3
...
@@ -31,6 +31,7 @@
...
@@ -31,6 +31,7 @@
#include <iomanip>
#include <iomanip>
#include "Log.h"
#include "Log.h"
#include "config.h"
NXLog
nx_log
;
NXLog
nx_log
;
...
@@ -78,7 +79,7 @@ std::string NXLog::stamp_to_string(const NXLogStamp& stamp) const
...
@@ -78,7 +79,7 @@ std::string NXLog::stamp_to_string(const NXLogStamp& stamp) const
}
}
else
else
{
{
#if
__cplusplus >= 201103L && (!defined(__GNUC__) || __GNUC__ >= 5)
#if
HAVE_STD_PUT_TIME
oss
<<
" "
<<
std
::
put_time
(
&
timeinfo
,
"%Y/%m/%d %H:%M:%S"
);
oss
<<
" "
<<
std
::
put_time
(
&
timeinfo
,
"%Y/%m/%d %H:%M:%S"
);
#else
#else
oss
<<
timestamp
.
tv_sec
;
oss
<<
timestamp
.
tv_sec
;
...
...
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