commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Regis Desgroppes (JIRA)" <j...@apache.org>
Subject [jira] Created: (LANG-478) StopWatch does not resist to system time changes
Date Fri, 09 Jan 2009 10:13:01 GMT
StopWatch does not resist to system time changes
------------------------------------------------

                 Key: LANG-478
                 URL: https://issues.apache.org/jira/browse/LANG-478
             Project: Commons Lang
          Issue Type: Bug
    Affects Versions: 2.3
         Environment: all operating systems.
            Reporter: Regis Desgroppes


org.apache.commons.lang.time.StopWatch seems to be relying on wall clock, i.e. by calling
java.lang.System.currentTimeMillis() to sample current time.

When a system time change occurs (user action, NTP synchronization...) between 2 calls to
StopWatch.getTime(), the difference between the 2 samples is wrong: the measured duration
may noticeably differ from the real one. Moreover, if the system time change consists in a
backward adjustment, the difference may be negative.

In order to make StopWatch resistant to system time changes, would it be possible to use the
process time, i.e. by making implementation calling java.lang.System.nanoTime() -multiplied
by 1000, of course-.

Thanks a lot,
Regis.


-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message