Time Stuff

Do you have a question? Post it now! No Registration Necessary

Translate This Thread From English to

Threaded View
In Time.h there is a structure defined for time settings.  I'm
building an embedded system that has a Real Time Clock but it's not PC
compatible.

My question is:

I don't some elements of the structure such as day of the week or day
of the year, but I do know year,month,date,hour,min,sec.  Does the
language support filling in the missing elements.  And is there a
consistency check for that time structure.

Thanks
George

Re: Time Stuff

Quoted text here. Click to load it



You're quite confused.  

1) "The language" has nothing particular to do with this.  Which is
just as well, since you forgot to mention what the language _is_.

2) <time.h> is part of the Standard C runtime library, and therefore
its behaviour is defined primarily by the C Standard, and secondarily
by your compiler toolchain's maker (which you forgot to specify, too).
Did you consult your documentation?  What did it say?

3) That your system is not a PC is irrelevant.  The only thing that
matters is whether your C platform is a "hosted environment", at least
as far as <time.h> is concerned, or not.

--
Hans-Bernhard Broeker ( snipped-for-privacy@physik.rwth-aachen.de)
Even if all the snow were burnt, ashes would remain.

Re: Time Stuff
Quoted text here. Click to load it


If you can't help shut up!!

George

Re: Time Stuff
Quoted text here. Click to load it
Hans-Bernard was being helpful. He pointed out that you hadn't told us:

    *    Which language
    *    Which platform
    *    Which toolchain

Without which only general advice can be given.

On many embedded systems you have to provide the implementation of
"standard" library routines either through hooks provided by the
compiler/toolchain author or directly as a complete routine. Since the
embedded system is under your control you might choose to:

    *    Completely ignore the elements in which you are not interested
    *    Provide fixed values for those uninteresting elements

It does depend though whether you are relying on thrid-party source for some
time related functions.

    Andrew



Re: Time Stuff
Quoted text here. Click to load it

OK.  Let's see if either you or Hans-Bernard can reply with an answer
or just more babble.

Language:  C
Platform:  One you are an expert with.  You can pick.
Toolchain:  Any one you choose.

Please tell us which Platform and Toolchain you've selected to talk
about and then answer the questins, if you can.

George

Re: Time Stuff

Quoted text here. Click to load it
secondarily
too).
Quoted text here. Click to load it
least
some

OK. The answers to your original questions are: No, and No.
Normally, I would include an explaination, but I fear you would consider it
"just more babble".

Bob



Re: Time Stuff
Quoted text here. Click to load it


How interesting.  An answer!!

Thank you. Bob

Re: Time Stuff
snipped-for-privacy@att.net says...
Quoted text here. Click to load it
They really are trying to help you know.

Extrapolating from what you have written.  

    - You have some hardware (micro, memory, RTC) of unknown origin
    - You have a tool chain of unknown brand and library support
    - You want to provide standard time functions

What you haven't provided is
    - which standard?
    - what functions do you wish to provide?
    - what support already exists?

Assuming that the answers to above questions are ANSI standard, all and
none respectively, the first thing you need is a reference for the C
standard library.  Then you could consider writing the functions yourself
or porting newlib or buying a library.

What are you trying to accomplish?  Familiarizing yourself with library
implementation?  Determine how long your board has been on?  Provide a
yet another blinking clock for people to set? Port a piece of code that
makes use of the time routines?  Provide support for others?

All of these may have different answers and they will change depending on
what support already exists.


I suspect what you need is to start with something like "The Standard C
Library" by Plauger

Robert

Re: Time Stuff
snipped-for-privacy@att.net (George) wrote in message
Quoted text here. Click to load it

getdate will fill them in.

Quoted text here. Click to load it

No but getdate will check its input.

Of course, this is completely useless advice, because getdate, struct
tm and friends are all part of a bigger picture. There have been and
continue to be variations on that picture. The advice above is
applicable to a working posix conformant system, which you don't, by
definition, have. Others seem to have wanted to help you to make (part
of) one or find out which part you have in order to solve your
problem, instead of just telling you how it should work.

Have a nice day
Darryl.

Site Timeline