Bug 437974

Summary: adjtime() doesn't adjust time
Product: [Fedora] Fedora Reporter: Miroslav Lichvar <mlichvar>
Component: glibcAssignee: Jakub Jelinek <jakub>
Status: CLOSED RAWHIDE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: low Docs Contact:
Priority: low    
Version: rawhideCC: drepper
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2008-04-04 22:41:00 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Miroslav Lichvar 2008-03-18 14:42:33 UTC
Description of problem:
adjtime no longer adjusts time. It seems to be related to the new
ADJ_OFFSET_SS_READ support introduced in
http://sources.redhat.com/cgi-bin/cvsweb.cgi/libc/sysdeps/unix/sysv/linux/adjtime.c.diff?r1=1.12.2.1&r2=1.12.2.2&cvsroot=glibc

Perhaps the "tntx.modes = ADJ_OFFSET_SS_READ;" assignment should be in the else
branch of "if (itv)" ?

Version-Release number of selected component (if applicable):
glibc-2.7.90-9
kernel-2.6.25-0.121.rc5.git4.fc9

How reproducible:
Always

Steps to Reproduce:
1. gcc -x c - <<EOF
#include <sys/time.h>

int main() {
        struct timeval tv, otv;

        tv.tv_sec = 0;
        tv.tv_usec = 100;
        adjtime(&tv, &otv);
        return 0;
}
EOF
2. ./a.out
  
Actual results:
Time not adjusted.

Expected results:
Time adjusted.

Additional info:
This breaks ntpd in -x mode.

Comment 1 Ulrich Drepper 2008-03-24 16:12:02 UTC
(In reply to comment #0)
> Perhaps the "tntx.modes = ADJ_OFFSET_SS_READ;" assignment should be in the else
> branch of "if (itv)" ?

Indeed.  Fixed upstream.

Comment 2 Jakub Jelinek 2008-04-04 22:41:00 UTC
Should be in glibc-2.7.90-12 and above.