Hide Forgot
Description of problem: Hi, then problem is based on https://bugzilla.redhat.com/show_bug.cgi?id=960570 I've tried to use time to measure problem, but time itself is not able to deal with time shift and show incorrent result How reproducible: 100% Steps to Reproduce: # CONST=70 # W=3 # time sleep $CONST& # BPID=$! # sleep $W # DOLD=`date` # date -s "now - 1 minute" # wait $BPID # date -s "now + 1 minute" # DNEW=`date` # let DIFF=(`date +%s -d "$DNEW"` - `date +%s -d "$DOLD"`) # echo $(($DIFF+$W)) == $CONST Actual results: time difference is 70 sec but time show: real 0m10.001s user 0m0.000s sys 0m0.001s Expected results: real 1m10.001s Thanks&Regards Honza
Judging from the output, you seem to be using your shell's `time', not the `/usr/bin/time' binary.
Despite you use built-in `time', there is the same problem with GNU time. I also think that time should measure monotonic (-alike) time not to get influenced by shifts in system clock. clock_gettime(2) offers: CLOCK_MONOTONIC -- suffers from NTP time adjustment. CLOCK_MONOTONIC_RAW -- uses real hardware clock, I worry about precision and access permission for non-root users. CLOCK_BOOTTIME -- includes time elapsed in suspension but suffers from NTP time adjustment. Is it worth? I guess the CLOCK_MONOTONIC_RAW is the most appropriate.
Created attachment 795594 [details] Test case
Upstream agreed to use clock_gettime(CLOCK_MONOTONIC) for measuring the "real" value.
Created attachment 1226439 [details] Proposed fix
Patches posted to upstream <http://lists.gnu.org/archive/html/bug-gnu-utils/2016-12/msg00000.html>, but upstream seems dead.
Created attachment 1239457 [details] Proposed fix
Red Hat Enterprise Linux 6 is in the Production 3 Phase. During the Production 3 Phase, Critical impact Security Advisories (RHSAs) and selected Urgent Priority Bug Fix Advisories (RHBAs) may be released as they become available. The official life cycle policy can be reviewed here: http://redhat.com/rhel/lifecycle This issue does not meet the inclusion criteria for the Production 3 Phase and will be marked as CLOSED/WONTFIX. If this remains a critical requirement, please contact Red Hat Customer Support to request a re-evaluation of the issue, citing a clear business justification. Note that a strong business justification will be required for re-evaluation. Red Hat Customer Support can be contacted via the Red Hat Customer Portal at the following URL: https://access.redhat.com/