Uploaded image for project: 'Log4cxx'
  1. Log4cxx
  2. LOGCXX-493

Documentation claiming `getTimeStamp` is in milliseconds but actually is in microseconds

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • 0.10.0
    • 0.11.0
    • Documentation

    Description

      The documentation implies that `getTimeStamp` returns a timesamp in milliseconds, see:

      /** Return the timeStamp of this event. */
      inline log4cxx_time_t getTimeStamp() const
              { return timeStamp; }
      

      and the member

      /** The number of milliseconds elapsed from 1/1/1970 until logging event
      was created. */
      log4cxx_time_t timeStamp;
      

      The problem is that in the constructor of `LoggingEvent`, the timestamp is filled with `apr_time_now()` that returns a timestamp in microseconds, see:

      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()) {
      }
      

      When encountered, the issue is not difficult to debug, but it would be nice to correct the documentation.

      Attachments

        Activity

          People

            tschoening Thorsten Schöning
            vthiery Vincent Thiery
            Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: