[ 
https://issues.apache.org/jira/browse/LOGCXX-361?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13940382#comment-13940382
 ] 

Florian Seydoux commented on LOGCXX-361:
----------------------------------------

Log4cxx use APR (apr_time_now()) for the timestamp (which offer microseconds 
resolution).

It's sadly true that this lib, under windows, get the 'current' time from a 
call to GetSystemTime (milliseconds resolution), before transforming it to a 
FILETIME (100-ns resolution), and rounding it to the required resolution.

Accordingly to [this post 
(stackoverflow)|http://stackoverflow.com/questions/4568221/c-get-system-time-to-microsecond-accuracy-on-windows]
 and [the windows timestamp 
project|http://www.windowstimestamp.com/description], it seems that directly 
calling 
[GetSystemTimeAsFileTime|http://msdn.microsoft.com/en-us/library/windows/desktop/ms724397%28v=vs.85%29.aspx]
 would, at least under windows vista and later, gives sub-milliseconds 
resolution. More accurate timing could be obtained using QueryPerformanceTimer.

Anyway, I would suggest to redirect this request to APR (if not already done).

> 15-16 milliseconds granularity on Windows‏
> ------------------------------------------
>
>                 Key: LOGCXX-361
>                 URL: https://issues.apache.org/jira/browse/LOGCXX-361
>             Project: Log4cxx
>          Issue Type: Improvement
>          Components: Layout
>         Environment: Windows NT/2003
>            Reporter: Sameer Gupta
>            Assignee: Curt Arnold
>   Original Estimate: 72h
>  Remaining Estimate: 72h
>
> I have noticed the message timestamps being logged are atleast 15-16 
> milliseconds apart on windows NT/2003 systems even though the messages 
> actually requested to be logged were just couple of milliseconds apart. This 
> is due to the functions being used in the log4cxx code which are based on the 
> SYSTEMTIME structure. The accuracy of these functions is 15-16 milliseconds 
> at the most. I have tried to play around with the code and implemented 
> performance counters to produce sub 15-16 milliseconds accuracy between two 
> message timestamps. This will specially help the users who develop low 
> latency applications. 
>  
> I am wondering if I can contribute my work to the project. Please let me know 
> how I can join the project as a developer and what is the procedure to 
> contribute. Opologies, if this has already been implemented.
>  
> Regards,
> Sameer



--
This message was sent by Atlassian JIRA
(v6.2#6252)

Reply via email to