如何处理C中的时间? [英] How to deal with time in C ?

查看:90
本文介绍了如何处理C中的时间?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我写了一个C程序,它输出特定的

输入信号。我的问题是,我想为某些范围的
用户输入产生输出。所以为此,我想每隔40ms调用一次我的程序。

之前,我从来没有按时完成任务。


我的软件运行linux操作系统一个HIL模拟器。

- 处理器是小端

- 从闪存启动

- Excalibur的输入时钟频率为20MHz

- SDRAM时钟频率为133MHz。


使用C库可以从任何处理器中获取时间吗?

任何人都可以建议如何处理我的问题?


谢谢,

srikanth。

解决方案

使用C库可以从任何处理器中获取时间吗?
任何人都可以建议如何处理我的问题??



它可能与C语言本身无关。也许

您可以查看POSIX标准。从这里开始:

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

时间功能描述如下:

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





您可以使用函数alarm()或setitimer(),getitimer()等。

它们在linux中可用。


问候,

Shailendra


" srikanth" < SR ******************* @ gmail.com>在消息中写道

news:11 ********************* @ g49g2000cwa.googlegro ups.com ...

我写了一个C-program,它输出特定
输入的信号。我的问题是,我想为某些范围的用户输入生成输出。所以为此,我想每隔40ms调用一次我的程序。
之前,我从来没有按时完成任务。

我的软件在HIL模拟器上运行linux操作系统。
- 处理器是小端
- 从闪存引导
- Excalibur的输入时钟频率为20MHz
- SDRAM时钟频率为133MHz。

使用C-library是它可以从任何处理器获得时间吗?
任何人都可以建议如何处理我的问题吗?

谢谢,

srikanth。




" srikanth" < SR ******************* @ gmail.com>在消息中写道

news:11 ********************* @ g49g2000cwa.googlegro ups.com ...

我写了一个C-program,它输出特定
输入的信号。我的问题是,我想为某些范围的用户输入生成输出。所以为此,我想每隔40ms调用一次我的程序。
之前,我从来没有按时完成任务。

我的软件在HIL模拟器上运行linux操作系统。
- 处理器是小端
- 从闪存引导
- Excalibur的输入时钟频率为20MHz
- SDRAM时钟频率为133MHz。

使用C-library是它可以从任何处理器获得时间吗?
任何人都可以建议如何处理我的问题吗?

谢谢,

srikanth。


考虑使用crontab?


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.

解决方案

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


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.




"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?


这篇关于如何处理C中的时间?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆