public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "michael dot kerrisk at gmx dot net" <sourceware-bugzilla@sourceware.org>
To: glibc-bugs@sources.redhat.com
Subject: [Bug libc/2449] New: adjtime() does not update oldelta if delta is NULL
Date: Sun, 12 Mar 2006 22:25:00 -0000	[thread overview]
Message-ID: <20060312222538.2449.michael.kerrisk@gmx.net> (raw)

According to 'info adjtime', if the OLDDELTA argument is not a NULL 
pointer, then adjtime() returns information about any previous time
adjustment that has not yet completed.

However, this is only done if DELTA is non-NULL (i.e., we
are also changing the adjustment).  If we want to simply retrieve
the current delta without changing it (as the info man page implies
we can), then specifying 'DELTA' as NULL does not cause the 
remaining delta to be returned in OLDDELTA. 

I believe the problem actually lies in the kernel, where the
following patch should fix things:

--- time.c.orig	2006-03-12 11:03:10.000000000 +1300
+++ time.c	2006-03-12 11:04:26.000000000 +1300
@@ -375,7 +375,9 @@
 	    /* p. 24, (d) */
 		result = TIME_ERROR;
 	
-	if ((txc->modes & ADJ_OFFSET_SINGLESHOT) == ADJ_OFFSET_SINGLESHOT)
+	if(txc->modes == 0)
+	    txc->offset    = time_adjust;
+	else if ((txc->modes & ADJ_OFFSET_SINGLESHOT) == ADJ_OFFSET_SINGLESHOT)
 	    txc->offset	   = save_adjust;
 	else {
 	    txc->offset = shift_right(time_offset, SHIFT_UPDATE);

However, I submit this against glibc, because it is the (more portable)
glibc adjtime() interface that is (IMO) broken by this problem.  If you 
agree that this is the needed fix you can either push it to the 
kernel folk, or ask me to do so.

Cheers,

Michael

-- 
           Summary: adjtime() does not update oldelta if delta is NULL
           Product: glibc
           Version: 2.4
            Status: NEW
          Severity: normal
          Priority: P2
         Component: libc
        AssignedTo: drepper at redhat dot com
        ReportedBy: michael dot kerrisk at gmx dot net
                CC: glibc-bugs at sources dot redhat dot com


http://sourceware.org/bugzilla/show_bug.cgi?id=2449

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


             reply	other threads:[~2006-03-12 22:25 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-03-12 22:25 michael dot kerrisk at gmx dot net [this message]
2006-04-02 17:35 ` [Bug libc/2449] " drepper at redhat dot com
2006-04-02 22:35 ` michael dot kerrisk at gmx dot net
2006-04-02 23:10 ` michael dot kerrisk at gmx dot net
2006-04-19 17:43 ` michael dot kerrisk at gmx dot net
2006-05-03  6:40 ` drepper at redhat dot com
2006-06-28 13:11 ` michael dot kerrisk at gmx dot net

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20060312222538.2449.michael.kerrisk@gmx.net \
    --to=sourceware-bugzilla@sourceware.org \
    --cc=glibc-bugs@sources.redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).