Bug 730350 - rewrite rhnsd to use difftime
Summary: rewrite rhnsd to use difftime
Alias: None
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: rhnsd
Version: 6.1
Hardware: Unspecified
OS: Unspecified
Target Milestone: rc
: ---
Assignee: Tomas Lestach
QA Contact: Red Hat Satellite QA List
Depends On:
TreeView+ depends on / blocked
Reported: 2011-08-12 14:51 UTC by Tomas Lestach
Modified: 2018-11-27 17:29 UTC (History)
3 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Last Closed: 2011-12-09 09:05:44 UTC

Attachments (Terms of Use)

Description Tomas Lestach 2011-08-12 14:51:31 UTC
Description of problem:
In rhnsd an integer/float will be added to time_t, what is not recommended.
Instead of that difftime shall be used - in the way we do not add amount of seconds to time_t, but to go the other way around - to make a difference of two times in time_t

double difftime ( time_t time2, time_t time1 );
 Return difference between two times
 Calculates the difference in seconds between time1 and time2.
 time2 - time_t object representing the latter of the two times.
 time1 - time_t object representing the earlier of the two times.
Return Value
 The difference in seconds (time2-time1) as a floating point double.

Version-Release number of selected component (if applicable):

time_t + float(int)
isn't strictly defined and may cause troubles mainly in the future, when internal representation of time_t changes

difftime() is recommended for time differences and shall always return time difference in seconds (also in the future)

Comment 1 Jan Pazdziora 2011-11-23 16:07:11 UTC
Tomas, the comment 0 is fairly confusing. Could you please amend the bugzilla with Actual results and Expected results, so that we have something to work wich while acking the proposed change, not mentioning the fact that QA will want this to make a test plan (should we ever decide some change is called for)?

Your cooperation in this matter would be greatly appreciated.

Comment 2 Tomas Lestach 2011-11-24 09:43:12 UTC
As already discussed with Simon, there's no real test plan available.
Everything we can do is to:
# grep difftime client/rhel/rhnsd/rhnsd.c

Adding float to time_t doesn't return correct values, however the deviation is that small (lowest rhnsd interval is 1 hour) that it's not really possible for QA to detect the difference between the correct behavior and misbehavior.

This BZ doesn't address any visible misbehavior, it addresses the concept and usage of adding and comparing of date structures.

Comment 3 Jan Pazdziora 2011-11-24 10:33:01 UTC
Thank you, Tomáš. Setting devel ack then. Let's leave it on QA to decide if they'd be able to QA the change at all.

Comment 5 RHEL Product and Program Management 2011-12-09 09:05:44 UTC
Quality Engineering Management has reviewed and declined this request.  You may
appeal this decision by reopening this request.

Note You need to log in before you can comment on or make changes to this bug.