473,320 Members | 1,940 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

How to deal with time in C ?

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.

Jul 23 '05 #1
8 1939
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:

http://www.unix.org/single_unix_specification/

The "time" function is described here:

http://www.opengroup.org/onlinepubs/...ions/time.html

Jul 23 '05 #2
Hi,

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

Regards,
Shailendra

"srikanth" <sr*******************@gmail.com> wrote in message
news:11*********************@g49g2000cwa.googlegro ups.com...
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.

Jul 23 '05 #3

"srikanth" <sr*******************@gmail.com> wrote in message
news:11*********************@g49g2000cwa.googlegro ups.com...
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?
Jul 23 '05 #4
Mac
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

Jul 23 '05 #5
In article <3h************@individual.net>,
Materialised <ma**********@privacy.net> wrote:

"srikanth" <sr*******************@gmail.com> wrote in message
news:11*********************@g49g2000cwa.googlegr oups.com...
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++
Jul 23 '05 #6
>> 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
Jul 23 '05 #7
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."

Jul 23 '05 #8
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

Jul 23 '05 #9

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
by: _mario lat | last post by:
I'd like to deal (update, deal, insert....) a database (with tables and relationship between these) by a tool written in php. I need to share and work on a database with other people. I'd like to...
6
by: christian9997 | last post by:
Hi We have started off using a $_GET parameter to keep track of the user's browser: We detect what browser the visitor is using when he first arrives on our website then we do a redirect to...
23
by: Steve Jorgensen | last post by:
Hi all, I'm working on a project through a consulting company, and I'm writing some database code for use in another programmer's project in Excel/VBA. The other programmer is working through...
11
by: srikanth | last post by:
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...
1
by: Davy | last post by:
My program deal with a several level tree with several branchs. The amount of branchs from father node is not known. So I want to creat a tree with dynamic branchs. Now I use the structure:...
7
by: rbt | last post by:
The house almost always wins or are my assumptions wrong... import random amounts = results = count = 0 while count < 10:
89
by: Tubular Technician | last post by:
Hello, World! Reading this group for some time I came to the conclusion that people here are split into several fractions regarding size_t, including, but not limited to, * size_t is the...
10
by: WebCM | last post by:
There is a function: http://paste.ubuntu.com/21865 It needs GMT date in YYYY-MM-DD HH:MM:SS format - in SQL: datetime. If date is the same as today, the function returns "Today". There is one...
8
by: Nick | last post by:
Hi there, Membership.GetNumberOfUsersOnline() works great the first time, then jumps up to the number of users registered in the system. I have tried enumerating through each user individually...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.