From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 14724 invoked by alias); 26 Jun 2011 22:17:48 -0000 Received: (qmail 14716 invoked by uid 22791); 26 Jun 2011 22:17:47 -0000 X-SWARE-Spam-Status: No, hits=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_PASS,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from www.meduna.org (HELO meduna.org) (92.240.244.38) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sun, 26 Jun 2011 22:17:34 +0000 Received: from dial-95-105-188-244-orange.orange.sk ([95.105.188.244] helo=[192.168.130.27]) by meduna.org with esmtpsa (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.69) (envelope-from ) id 1Qaxdq-00072a-CZ for ecos-discuss@ecos.sourceware.org; Mon, 27 Jun 2011 00:17:30 +0200 Message-ID: <4E07AFED.6040405@meduna.org> Date: Sun, 26 Jun 2011 22:17:00 -0000 From: Stanislav Meduna User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.18) Gecko/20110616 Lightning/1.0b2 Thunderbird/3.1.11 MIME-Version: 1.0 To: eCos Discussion Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Authenticated-User: stano@meduna.org X-Authenticator: dovecot_plain X-Spam-Score: -8.2 X-Spam-Score-Int: -81 X-Exim-Version: 4.69 (build at 30-Jan-2011 20:48:48) X-Date: 2011-06-27 00:17:30 X-Connected-IP: 95.105.188.244:4009 X-Message-Linecount: 45 X-Body-Linecount: 35 X-Message-Size: 1593 X-Body-Size: 1137 X-Received-Count: 1 X-Recipient-Count: 1 X-Local-Recipient-Count: 1 X-Local-Recipient-Defer-Count: 0 X-Local-Recipient-Fail-Count: 0 X-IsSubscribed: yes Mailing-List: contact ecos-discuss-help@ecos.sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: ecos-discuss-owner@ecos.sourceware.org Subject: [ECOS] Adjustable wallclock (get/settimeofday, adjtimex)? X-SW-Source: 2011-06/txt/msg00066.txt.bz2 Hi, the gettimeofday method in compat/posix is currently implemented based on cyg_current_time(), settimeofday is missing. If I understand it correctly the cyg_current_time() is also used for timeout processing all over the code so messing with its base is not a good idea. There is also an io/wallclock, but this provides only a 1-second resolution and warns of up to one second delay when reading/writing. I need to implement a NTP-like model soon, which means: - gettimeofday with best possible resolution and negligible call delay - settimeofday - the ability to speed up or slow the clock (adjtime/adjtimex or similar), both permanently or until the requested offset is compensated for; the clock must not go backward - the ability to initialize from / store the current time to a battery-backed device What is the best way to approach it? Should I modify the Cyg_RealTimeClock? Should I attach an alarm there on each tick and do my stuff there? How to make gettimeofday use the 'new' clock so it does not look like an ugly hack? Anyone already approached this? Thanks -- Stano -- Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss