You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@logging.apache.org by "Vincent Thiery (JIRA)" <lo...@logging.apache.org> on 2017/10/16 07:46:02 UTC
[jira] [Created] (LOGCXX-493) Documentation claiming `getTimeStamp`
is in milliseconds but really is in microseconds
Vincent Thiery created LOGCXX-493:
-------------------------------------
Summary: Documentation claiming `getTimeStamp` is in milliseconds but really is in microseconds
Key: LOGCXX-493
URL: https://issues.apache.org/jira/browse/LOGCXX-493
Project: Log4cxx
Issue Type: Bug
Components: Documentation
Affects Versions: 0.10.0
Reporter: Vincent Thiery
Priority: Minor
The documentation implies that `getTimeStamp` returns a timesamp in *milliseconds*, see:
{code:cpp}
/** Return the timeStamp of this event. */
inline log4cxx_time_t getTimeStamp() const
{ return timeStamp; }
{code}
and the member
{code:cpp}
/** The number of milliseconds elapsed from 1/1/1970 until logging event
was created. */
log4cxx_time_t timeStamp;
{code}
The problem is that in the constructor of `LoggingEvent`, the timestamp is filled with `apr_time_now()` that returns a timestamp in *microseconds*, see:
{code:cpp}
LoggingEvent::LoggingEvent(
const LogString& logger1, const LevelPtr& level1,
const LogString& message1, const LocationInfo& locationInfo1) :
logger(logger1),
level(level1),
ndc(0),
mdcCopy(0),
properties(0),
ndcLookupRequired(true),
mdcCopyLookupRequired(true),
message(message1),
timeStamp(apr_time_now()),
locationInfo(locationInfo1),
threadName(getCurrentThreadName()) {
}
{code}
When encountered, the issue is not difficult to debug, but it would be nice to correct the documentation.
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)