How to deal with time in C ?

Discussion in 'C Programming' started by srikanth, Jun 17, 2005.

  1. srikanth

    srikanth Guest

    i have written one C -programm, which outputs signals for specific
    input. what my question is, i want to produce outputs for some range of
    user inputs. so for this i want to call my programm for every 40ms.
    Before, i never dealed with time.

    my software is running with linux operation system on a HIL simulator.
    - Processor is little endian
    - Boot from flash
    - Input clock frequency for Excalibur is 20MHz
    - SDRAM clock frequency is 133MHz.

    Using C-libraries is it possible to get time from any processor??
    Could any one please suggest how to proceed for my problem??

    Thank you,

    srikanth.
     
    srikanth, Jun 17, 2005
    #1
    1. Advertising

  2. Jean-Claude Arbaut, Jun 17, 2005
    #2
    1. Advertising

  3. srikanth

    pete Guest

    Jean-Claude Arbaut wrote:
    >
    > > Using C-libraries is it possible to get time from any processor??
    > > Could any one please suggest how to proceed for my problem??

    >
    > It's probably not related to the C laguage itself. Maybe
    > you can have a look at the POSIX standard. Start here:


    Try harder.

    N869
    7.23 Date and time <time.h>
    7.23.1 Components of time
    [#1] The header <time.h> defines four macros, and declares
    several types and functions for manipulating time.

    http://www.open-std.org/jtc1/sc22/wg14/www/docs/n869/

    --
    pete
     
    pete, Jun 17, 2005
    #3
  4. Le 17/06/2005 14:26, dans , « pete »
    <> a écrit :

    > Jean-Claude Arbaut wrote:
    >>
    >>> Using C-libraries is it possible to get time from any processor??
    >>> Could any one please suggest how to proceed for my problem??

    >>
    >> It's probably not related to the C laguage itself. Maybe
    >> you can have a look at the POSIX standard. Start here:

    >
    > Try harder.


    :) :) :) :) :)

    I give up ! :-D


    > N869
    > 7.23 Date and time <time.h>
    > 7.23.1 Components of time
    > [#1] The header <time.h> defines four macros, and declares
    > several types and functions for manipulating time.
    >
    > http://www.open-std.org/jtc1/sc22/wg14/www/docs/n869/
     
    Jean-Claude Arbaut, Jun 17, 2005
    #4
  5. Hi,

    You can use functions alarm() or setitimer(),getitimer() etc.
    They are available in linux.

    Regards,
    Shailendra

    "srikanth" <> wrote in message
    news:...
    > i have written one C -programm, which outputs signals for specific
    > input. what my question is, i want to produce outputs for some range of
    > user inputs. so for this i want to call my programm for every 40ms.
    > Before, i never dealed with time.
    >
    > my software is running with linux operation system on a HIL simulator.
    > - Processor is little endian
    > - Boot from flash
    > - Input clock frequency for Excalibur is 20MHz
    > - SDRAM clock frequency is 133MHz.
    >
    > Using C-libraries is it possible to get time from any processor??
    > Could any one please suggest how to proceed for my problem??
    >
    > Thank you,
    >
    > srikanth.
    >
     
    Mehta Shailendrakumar, Jun 17, 2005
    #5
  6. srikanth

    Eric Sosman Guest

    pete wrote:

    > Jean-Claude Arbaut wrote:
    >
    >>>Using C-libraries is it possible to get time from any processor??
    >>>Could any one please suggest how to proceed for my problem??

    >>
    >>It's probably not related to the C laguage itself. Maybe
    >>you can have a look at the POSIX standard. Start here:

    >
    >
    > Try harder.
    >
    > N869
    > 7.23 Date and time <time.h>
    > 7.23.1 Components of time
    > [#1] The header <time.h> defines four macros, and declares
    > several types and functions for manipulating time.


    Unfortunately, the <time.h> facilities will not meet the
    O.P.'s need, which is for a recurring execution with a 40-ms
    period. As Jean-Claude said, he'll need to go beyond Standard
    C to achieve this.

    --
    Eric Sosman
    lid
     
    Eric Sosman, Jun 17, 2005
    #6
  7. srikanth

    Materialised Guest

    [OT] Re: How to deal with time in C ?

    "srikanth" <> wrote in message
    news:...
    > i have written one C -programm, which outputs signals for specific
    > input. what my question is, i want to produce outputs for some range of
    > user inputs. so for this i want to call my programm for every 40ms.
    > Before, i never dealed with time.
    >
    > my software is running with linux operation system on a HIL simulator.
    > - Processor is little endian
    > - Boot from flash
    > - Input clock frequency for Excalibur is 20MHz
    > - SDRAM clock frequency is 133MHz.
    >
    > Using C-libraries is it possible to get time from any processor??
    > Could any one please suggest how to proceed for my problem??
    >
    > Thank you,
    >
    > srikanth.
    >

    Thought about using crontab?
     
    Materialised, Jun 17, 2005
    #7
  8. srikanth

    Mac Guest

    On Fri, 17 Jun 2005 04:54:15 -0700, srikanth wrote:

    > i have written one C -programm, which outputs signals for specific
    > input. what my question is, i want to produce outputs for some range of
    > user inputs. so for this i want to call my programm for every 40ms.
    > Before, i never dealed with time.
    >
    > my software is running with linux operation system on a HIL simulator.
    > - Processor is little endian
    > - Boot from flash
    > - Input clock frequency for Excalibur is 20MHz
    > - SDRAM clock frequency is 133MHz.
    >
    > Using C-libraries is it possible to get time from any processor??
    > Could any one please suggest how to proceed for my problem??
    >
    > Thank you,
    >
    > srikanth.


    Please don't cross-post to comp.lang.c and comp.lang.c++. This is RARELY
    productive.

    In this case, I believe your question is off-topic in both groups. Perhaps
    a group dedicated to the system you are using would be a better choice. If
    there is no such group, then maybe a mailing list?

    In general, I think it is impossible to guarantee deterministic periodic
    operation unless you have a real-time OS, but maybe I'm wrong, somehow.

    For more information about comp.lang.c, see the faq:
    http://www.eskimo.com/~scs/C-faq/top.html

    You can also read this welcome message:
    http://www.ungerhu.com/jxh/clc.welcome.txt

    I'm sure there are similar resources for comp.lang.c++, but I don't know
    where to find them.

    --Mac
     
    Mac, Jun 17, 2005
    #8
  9. Re: [OT] Re: How to deal with time in C ?

    In article <>,
    Materialised <> wrote:
    >
    >"srikanth" <> wrote in message
    >news:...
    >> i have written one C -programm, which outputs signals for specific
    >> input. what my question is, i want to produce outputs for some range of
    >> user inputs. so for this i want to call my programm for every 40ms.
    >> Before, i never dealed with time.
    >> ...

    >Thought about using crontab?


    Pls note the bit where he says 40ms.
    --
    7842++
     
    Anonymous 7843, Jun 17, 2005
    #9
  10. Re: [OT] Re: How to deal with time in C ?

    >> Using C-libraries is it possible to get time from any processor??
    >> Could any one please suggest how to proceed for my problem??
    >>
    >> Thank you,
    >>
    >> srikanth.
    >>

    >Thought about using crontab?


    You want the OP to use crontab to invoke something every 40
    MILLISECONDS? The implementations of crontab I've seen don't even
    let you specify seconds. You can do once a minute.

    Gordon L. Burditt
     
    Gordon Burditt, Jun 17, 2005
    #10
  11. srikanth

    Guest

    Does your hardware have a timer chip like 8254 or something? in that
    case,
    int baseAddress, counter0, counter1, counter2;

    baseAddress = N; /* your 8254 card's base address in decimal */

    counter0 = baseAddress;
    counter1 = baseAddress + 1;
    counter2 = baseAddress + 2;

    use outb functions(family of functions for low level I/O)
    outb(counter0,NUM);
    and you can program the timer in a convinient mode, and write an
    interrupt service routine.I think this will work for "40 milli
    seconds."
     
    , Jun 18, 2005
    #11
  12. srikanth

    srikanth Guest

    Thank you for every one , but i still dint follow some answers (as i
    told you, in past i never deal with time ).
    thank you,
    srikanth
     
    srikanth, Jun 21, 2005
    #12
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. engsol
    Replies:
    2
    Views:
    959
    Dan Bishop
    Jan 26, 2004
  2. Replies:
    8
    Views:
    483
    Magnus Lycka
    Aug 5, 2005
  3. rbt

    deal or no deal

    rbt, Dec 22, 2005, in forum: Python
    Replies:
    7
    Views:
    561
    Duncan Smith
    Dec 28, 2005
  4. Peter Hansen
    Replies:
    0
    Views:
    720
    Peter Hansen
    Feb 22, 2006
  5. flamesrock
    Replies:
    8
    Views:
    486
    Hendrik van Rooyen
    Nov 24, 2006
Loading...

Share This Page