Re: settimeofday function taking 24 - 30 minutes to complete

From: Poul-Henning Kamp <phk_at_phk.freebsd.dk>
Date: Sat, 23 Dec 2006 08:28:35 +0000
I'll take care of this one.

Poul-Henning

In message <790a9fff0612222340n7ccfc050ldb260bf0ef63c548_at_mail.gmail.com>, "Scot
 Hetzel" writes:
>------=_Part_31044_23325724.1166859614558
>Content-Type: text/plain; charset=ISO-8859-1; format=flowed
>Content-Transfer-Encoding: 7bit
>Content-Disposition: inline
>
>On 12/23/06, Scot Hetzel <swhetzel_at_gmail.com> wrote:
>> By making the following change, the test program no longer hangs the system:
>>
>>        /*
>>         * Calculate local time to put in RTC
>>         * Ignore UTC offset, if it would cause the time < Jan 1, 1970 00:00.
>>         */
>>        if (tm >= utc_offset())
>>                tm -= utc_offset();
>>        else
>>                printf("resettodr: utc_offset > tm");
>>
>> We probably need to change all the locations that use utc_offset(), to
>> have a similar "if (x >= utc_offset()) x -= utc_offset();".
>>
>Attached is a patch that fixes most of the x -= utc_offset(); cases in
>the kernel.
>
>The only one that's not fixed is in sys/dev/twa/tw_osl_inline.h.
>
>Scot
>
>-- 
>DISCLAIMER:
>No electrons were mamed while sending this message. Only slightly bruised.
>
>------=_Part_31044_23325724.1166859614558
>Content-Type: text/plain; name=utc_offset.fix; charset=ANSI_X3.4-1968
>Content-Transfer-Encoding: base64
>X-Attachment-Id: f_ew1q2gan
>Content-Disposition: attachment; filename="utc_offset.fix"
>
>SW5kZXg6IGFtZDY0L2lzYS9jbG9jay5jCj09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09
>PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT0KUkNTIGZpbGU6IC9ob21lL25jdnMv
>c3JjL3N5cy9hbWQ2NC9pc2EvY2xvY2suYyx2CnJldHJpZXZpbmcgcmV2aXNpb24gMS4yMjgKZGlm
>ZiAtdSAtcjEuMjI4IGNsb2NrLmMKLS0tIGFtZDY0L2lzYS9jbG9jay5jCTMgRGVjIDIwMDYgMDM6
>NDk6M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Version: 1.0
>Content-Transfer-Encoding: 7bit
>Content-Disposition: inline
>
>_______________________________________________
>freebsd-current_at_freebsd.org mailing list
>http://lists.freebsd.org/mailman/listinfo/freebsd-current
>To unsubscribe, send any mail to "freebsd-current-unsubscribe_at_freebsd.org"
>------=_Part_31044_23325724.1166859614558--
>

-- 
Poul-Henning Kamp       | UNIX since Zilog Zeus 3.20
phk_at_FreeBSD.ORG         | TCP/IP since RFC 956
FreeBSD committer       | BSD since 4.3-tahoe    
Never attribute to malice what can adequately be explained by incompetence.
Received on Sat Dec 23 2006 - 08:00:12 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:39:04 UTC