This is the mail archive of the ecos-discuss@sources.redhat.com mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: gettimeofday??


On Thu, Aug 30, 2001 at 04:50:49PM +0200, Stijn Symons wrote:
> Hi again,
> 
> is there a way to get the gettimeofday function to work?

Include the SNMP library package. This implements get time of day:

int gettimeofday(struct timeval *tv,
                 struct timezone *tz)
{
    struct _timeb timebuffer;
 
    _ftime(&timebuffer);
    tv->tv_usec = timebuffer.millitm * 1000;
    tv->tv_sec = timebuffer.time;
    return(0);
}

> We're working
> on an iPAQ and at the moment testing on Linux sythetic target.  At this
> moment we're getting an undefined reference error on it, we also can't
> find any link between gettimeofday and cyg_hal_gettimeofday (or is this
> normal?)

Thats normal. You should remember that the synthetic target uses
synthetic time. Its world starts at the beginnig of the epoc. If you
want to fast forward history for 30 years, you can call
cyg_hal_sys_gettimeofday to get the time in the real world and then
use cyg_libc_time_settime to set the synthetic worlds clock. The clock
will not be accurate though, because one synthetic second may not be
one real second.
 
> And could anybody tell us were the source code of the
> cyg_hal_gettimeoftime is? or  isn't that part open-source?

find . -type f | xargs grep  cyg_hal_gettimeoftime   

returns nothing. That function does not exist.

        Andrew


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]