From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 23042 invoked by alias); 14 Feb 2012 14:45:12 -0000 Received: (qmail 22927 invoked by uid 22791); 14 Feb 2012 14:45:11 -0000 X-SWARE-Spam-Status: No, hits=-2.1 required=5.0 tests=AWL,BAYES_00,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from gw.kuantic.com (HELO gw.kuantic.com) (213.244.28.44) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 14 Feb 2012 14:44:57 +0000 Received: from [10.0.0.43] (gw2.kuantic.com [213.244.28.45]) (authenticated bits=0) by gw.kuantic.com (8.14.5/8.14.4) with ESMTP id q1EEirtQ002612 (version=TLSv1/SSLv3 cipher=DHE-RSA-CAMELLIA256-SHA bits=256 verify=NO) for ; Tue, 14 Feb 2012 15:44:55 +0100 Message-ID: <4F3A7362.4000007@kuantic.com> Date: Tue, 14 Feb 2012 14:45:00 -0000 From: =?UTF-8?B?QmVybmFyZCBGb3VjaMOp?= User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:9.0) Gecko/20111222 Thunderbird/9.0.1 MIME-Version: 1.0 To: ecos-devel@ecos.sourceware.org Subject: Re: Wallclock - calendar option References: <3722057-9c72442ea03eee8ad26a7165c8bc15af@pmq2.m5r2.onet> In-Reply-To: <3722057-9c72442ea03eee8ad26a7165c8bc15af@pmq2.m5r2.onet> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-IsSubscribed: yes Mailing-List: contact ecos-devel-help@ecos.sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Post: List-Help: , Sender: ecos-devel-owner@ecos.sourceware.org X-SW-Source: 2012-02/txt/msg00003.txt.bz2 Le 14/02/2012 12:09, qber_ a écrit : > Hello all. > I want to discuss an option of Wallclock device framework.. Now the wallclock supports two option : init_get and set_get. This functions support time counted from 1970-01-01 00:00:00. The idea is to add the support for calendar insted of seconds counter. Most of applications uses calendar not seconds counter. > The change for handling date and time for me is a result of working with STM32F2x processor which has calendar based RTC. The is no sense for converting calendar to seconds and then back again to calendar. > The problem is which date and time format should be selected (if this change will be added to officail reposotory). > Best Regards > Qber Hello Qber, time_t (or any similar integer counter) is used everywhere inside CPUs, calendar time is used only to interface with entities externals to the MCU/CPU like humans, files/databases, network. Usually there is much more internal time calculations than time data output from a CPU in calendar representation. It's very hard to see any gain by using nightmarish calendar calculations when simple integer arithmetic can be used instead. Write a function that adds a variable amount of time to data represented as calendar date/time and compare it to an integer addition. Conversion functions between time_t and calendar date/time exist from 1970-01-01 00:00:00. Even Windows uses an integer representation, even probably the Maya as shown by their overflow problem at the end of the year. Bernard