Hi
I am no Kernel Programmer;), however I guess what u are looking for
is: gettimeofday()
e.g.
#include <sys/time.h>
#include <stdio.h>
void main()
{
struct timeval tv;

gettimeofday(&tv, NULL);

unsigned long long millisecondsSinceEpoch =
    (unsigned long long)(tv.tv_sec) * 1000 +
    (unsigned long long)(tv.tv_usec) / 1000;

printf("ms since 1/1/1970: %llu\n", millisecondsSinceEpoch);
}

Hint: if you are searching for ANSI c hints in google, add ansi or cpp
or POSIX to your question, e.g.:
"gcc unix  timestamp milliseconds"
HTH


On Thu, Jun 16, 2016 at 1:28 AM,  <paras.g...@sestrasystems.com> wrote:
> I am new to kernel programing and am trying to find a way to get a timestamp
> into some kernel code we had custom written for us.
>
> it looks like the normal c library time.h has a get_clocktime() function,
> but this does not exists in the linux/time.h lib.
>
> Is there a way to stamp my debug/info meassges from my kernel code with a
> time at millisecond resolution. The timestamp on the log file is buffered
> and thefore off.
>
> Thanks
>
> --
> For more options, visit http://beagleboard.org/discuss
> ---
> You received this message because you are subscribed to the Google Groups
> "BeagleBoard" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to beagleboard+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/beagleboard/aeaec6ce-e16c-41c4-8866-4415bc7d6c02%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

-- 
For more options, visit http://beagleboard.org/discuss
--- 
You received this message because you are subscribed to the Google Groups 
"BeagleBoard" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to beagleboard+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/beagleboard/CAK4vXrsJfjxZrODTWYtf7hcFiY2n89JR4T1sTVyS_b1v9hwLJQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to