This is the mail archive of the ecos-discuss@sources.redhat.com mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Help with using wallclock


>>>>> "Dave" == David Roethig <droethig@cipher.com> writes:

    Dave> I have some basic questions about the use of the wallclock package.

    Dave> Currently, the following are defined:
    Dave>     CYGPKG_IO_WALLCLOCK
    Dave>     CYGSEM_WALLCLOCK_MODE : init_get
    Dave>     CYGPKG_WALLCLOCK_EMULATE

    Dave> My basic misunderstanding is the relationship between the
    Dave> application's view of time (HH:MM:SS DD MM YYYY) and how
    Dave> this is updated/made current by the wallclock package.

    Dave> I've read the documentation but I don't understand which the
    Dave> application-level API calls can/should be used.

    Dave> Are there functions/macros to convert from human-time to
    Dave> seconds? (i.e. 14 Feb 2005 10:23:00 to xxx seconds since
    Dave> 1970-01-01 00:00:00)

    Dave> What is the relationship between libc time() and the
    Dave> wallclock package?

The libc functions use the wallclock device to provide the current
time. Hence the API to access the wallclock consists of the standard C
library functions time(), strftime(), etc. A separate application
level API provided by wallclock devices would just lead to duplication
of code.

There is one extension to the standard C library,
cyg_libc_time_settime(), to update the wallclock device.

    Dave> How is the emulated wallclock updated?

The eCos kernel has a system clock which normally ticks at 100Hz, and
the emulation wallclock device uses this to calculate a seconds value.
The base time is likely to be 00:00:00 UTC, January 1, 1970. Accuracy
depends on the underlying system clock.

    Dave> My eventual goal is to use the RTC on the microcontroller we
    Dave> are using (Sharp LH79520). This would change the
    Dave> implementation but will it have an effect on the application
    Dave> level interface?

Nope, the API stays the same but should give more useful results -
assuming the RTC is properly initialized.

Bart

-- 
Bart Veer                       eCos Configuration Architect
http://www.ecoscentric.com/     The eCos and RedBoot experts
Besuchen Sie uns vom 22-24.02.05 auf der Embedded World 2005, Stand 11-124
Visit us at Embedded World 2005, Nürnberg, Germany, 22-24 Feb, Stand 11-124

-- 
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]