-1

我正在尝试为 Zynq 做一个简单的 STANDALONE 应用程序。我想使用“time.h”来操作日期/时间。我知道独立 BSP 上没有硬件实现,但我想自己连接它。在编译期间,当我调用“time(NULL)”时出现错误,即没有“_gettimeofday()”的实现。我已经找到它并根据函数定义实现了它,这样错误就消失了,一切看起来都很好,但是当我在硬件上运行我的项目时,我从 time() 中只看到零。有人可以帮忙吗?

问候, G2

4

1 回答 1

0

Ok, I've done some research, and found this link. This is almost what I'v been searching, but instead of '_times()' I needed '_gettimeofday()' and this is my implementation:

int _gettimeofday(struct timeval *__p, void *__tz)
{
    __p->tv_sec = (systemUsCounter / 1000000);
    __p->tv_usec = systemUsCounter;
    return 0;
}

I left the '__tz' pointer with no chainges. So this is basicly how to utilize 'time.h' in a standalone application on Zynq.

于 2015-02-10T08:12:58.343 回答