[maemo-developers] System time in miliseconds for N800

From: gary liquid liquid at gmail.com
Date: Tue Jul 8 22:51:00 EEST 2008
nisa,

I believe the following will supply timing to ms level.
I'm not sure about it being relative to program start as I usually call it
once at the start of a process and once again when I am done.  Its enough
for me to calculate fairly accurate FPS calculations (the only thing it was
needed for).
The difference between them (barring wrap around issues) is the time.

#include <sys/time.h>

unsigned long GetTicks()
{
    struct timeval now;
    unsigned long ticks;
    gettimeofday(&now, NULL);
    ticks=(now.tv_sec)*1000+(now.tv_usec)/1000;
    return(ticks);
}


Gary (lcuk on #maemo)



On Tue, Jul 8, 2008 at 7:24 PM, nisha jain <jain61 at gmail.com> wrote:

> Hi All,
>
> I am trying to get current system time in milliseconds with respect to the
> program starting using
>
> #include <sys/timeb.h>
>
> As i need to milisecond precision and i checked this header it is present
> under ARMEL
>
> but i am not able to include it during compile time i used
> -I/usr/include/sys path as it is
>
> present under this path... I am not sure how i can include and use it?
>
> Please if some one know how the N800 System time can be captured in
> millisecond precision let me know?
>
> I also tried using the CLOCKS_PER_SEC command to use it but it is not
> giving proper values
>
> Please let me know if some does similar and  have solution for it?
>
> Thanks and Regards,
> Nisha
>
> _______________________________________________
> maemo-developers mailing list
> maemo-developers at maemo.org
> https://lists.maemo.org/mailman/listinfo/maemo-developers
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.maemo.org/pipermail/maemo-developers/attachments/20080708/8e734679/attachment.htm 
More information about the maemo-developers mailing list