I think maybe you are doing that for doing simulation in TOSSIM.

By default, nesc does not include the the directories such as  /sys..
You just need to add those directories in makefile:  PFLAGS += -I...
An intermediate product of NESC compiler is app.c, that means all code are
tranlated into c code first.

On 4/9/08, antonio gonga <[EMAIL PROTECTED]> wrote:
>
> 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! Try 
> it!<http://spaces.live.com/spacesapi.aspx?wx_action=create&wx_url=/friends.aspx&mkt=en-us>
>
> _______________________________________________
> Tinyos-help mailing list
> Tinyos-help@millennium.berkeley.edu
> https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help
>



-- 
Renjie Huang
Sensorweb Research Laboratory
http://sensorweb.vancouver.wsu.edu/
Washington State University
_______________________________________________
Tinyos-help mailing list
Tinyos-help@millennium.berkeley.edu
https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help

Reply via email to