Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.

Bug 1004416

Summary: time does not show really consumed time
Product: Red Hat Enterprise Linux 6 Reporter: Jan Ščotka <jscotka>
Component: timeAssignee: Petr Pisar <ppisar>
Status: CLOSED WONTFIX QA Contact: BaseOS QE - Apps <qe-baseos-apps>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 6.4CC: bnater, jscotka, psabata
Target Milestone: rcKeywords: FastFix, Patch
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
URL: http://lists.gnu.org/archive/html/bug-gnu-utils/2013-09/msg00003.html
Whiteboard:
Fixed In Version: Doc Type: No Doc Update
Doc Text:
undefined
Story Points: ---
Clone Of:
: 1005807 1412149 (view as bug list) Environment:
Last Closed: 2017-12-06 10:44:27 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
Test case
none
Proposed fix
none
Proposed fix none

Description Jan Ščotka 2013-09-04 15:07:15 UTC
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

Comment 2 Petr Šabata 2013-09-04 15:20:13 UTC
Judging from the output, you seem to be using your shell's `time', not the `/usr/bin/time' binary.

Comment 3 Petr Pisar 2013-09-09 12:24:20 UTC
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.

Comment 4 Petr Pisar 2013-09-09 12:24:52 UTC
Created attachment 795594 [details]
Test case

Comment 8 Petr Pisar 2014-10-21 13:15:50 UTC
Upstream agreed to use clock_gettime(CLOCK_MONOTONIC) for measuring the "real" value.

Comment 11 Petr Pisar 2016-11-30 17:08:10 UTC
Created attachment 1226439 [details]
Proposed fix

Comment 12 Petr Pisar 2017-01-11 10:17:18 UTC
Patches posted to upstream <http://lists.gnu.org/archive/html/bug-gnu-utils/2016-12/msg00000.html>, but upstream seems dead.

Comment 13 Petr Pisar 2017-01-11 14:27:03 UTC
Created attachment 1239457 [details]
Proposed fix

Comment 14 Jan Kurik 2017-12-06 10:44:27 UTC
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/