Hey all,
I want to use a precise timer so that I would like to use the Unix struct 
timeval to get the time in microseconds
The small code bellow gets the time in microseconds
#include <stdlib.h>
#include <sys/time.h>
struct timeval tv;
unsigned long getTime(){
   gettimeofday(&tv, NULL)
   return tv.tv_usec;
}
int main(){
 printtf("Time in u_seconds: %3d\n", getTime());
 return 0;
}
I want to embed or call the function getTime() in the nesC App. I created a .h 
file and a .c file which contains the function getTime(). How should I modify 
my Makefile to compile and link the c code with the nesC app?

COMPONENT = MyComponentC
BUILD_EXTRA_DEPS = utime.o
utime.o: utime.c 
         gcc -g -o -Wall -pedantic utime.c
include $(MAKERULES)

utime.h
#include <stdlib.h>
#include <sys/time.h>
struct timeval tv;
------------------------------------------------------
utime.c
----------------------
#include "utime.h"

unsigned long getTime(){
  gettimeofday(&tv, NULL);
  return tv.tv_usec;
}

.nc File
#include "utime.h"
module myModule{
}....

When I try to compile I get several error massages.. one of them is " 
sys/time.h" file not found

Thanks in advance...


_________________________________________________________________
Invite your mail contacts to join your friends list with Windows Live Spaces. 
It's easy!
http://spaces.live.com/spacesapi.aspx?wx_action=create&wx_url=/friends.aspx&mkt=en-us
_______________________________________________
Tinyos-help mailing list
[email protected]
https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help

Reply via email to