public inbox for ecos-devel@sourceware.org
 help / color / mirror / Atom feed
* Wallclock - calendar option
@ 2012-02-14 11:13 qber_
  2012-02-14 14:45 ` Bernard Fouché
  0 siblings, 1 reply; 2+ messages in thread
From: qber_ @ 2012-02-14 11:13 UTC (permalink / raw)
  To: ecos-devel

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Wallclock - calendar option
  2012-02-14 11:13 Wallclock - calendar option qber_
@ 2012-02-14 14:45 ` Bernard Fouché
  0 siblings, 0 replies; 2+ messages in thread
From: Bernard Fouché @ 2012-02-14 14:45 UTC (permalink / raw)
  To: ecos-devel


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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2012-02-14 14:45 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-02-14 11:13 Wallclock - calendar option qber_
2012-02-14 14:45 ` Bernard Fouché

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).