> What problem are you trying to solve?
I need to be able to pinpoint two time instants. I’m writing a rule-based NIDS.
For example, if a mote receives 10 pings within 2 minutes from a specific mote,
I need to send an alert to the EMS (Event Management System). Right now I’m
able to send the alert when 10 pings are sent from a specific mote. What I now
need is to store a time value (time_t was my intention) of when the first ping
is received, and when the counter reaches 10, I need to store another time
value and compare the two in order to decide wether 2 minutes have passed or
not. Also, 2 minutes are just a simplistic example, I want to be able to
specify hour and day intervals also.
Using time.h would solve my problem.
On Wednesday 30 October 2013 at 20:49, Eric Decker [via TinyOS - Help] wrote:
>
>
>
> On Wed, Oct 30, 2013 at 11:17 AM, João Amaral <[hidden email]
> (/user/SendEmail.jtp?type=node&node=23755&i=0)> wrote:
> > Hello.
> >
> > Is it possible to include time.h in nesC code?
>
> Not really. Too painful.
>
> Sure it is possible, probably with a lot of work….. But first let me ask
> why?
>
> What problem are you trying to solve?
>
>
> > I ran "grep -R 'time.h'" on
> > $TOSROOT and I saw some occurrences in .c files (mainly CoAP related), but
>
> Those are all files that get compiled for use on Linux boxes.
>
> > only one in a nesC file (TcpP.nc).
>
>
> Evern that one is still for a Linux box. Its inside an #ifdef PC. Not
> sure what he
> is doing there though.
>
> > I tried using "include <time.h>" and
> > "include <sys/time.h>" in my application, but both result in compilation
> > error: time.h: No such file or directory.
> >
> > I need to compute the difference between two instants of time.
>
> First the time values that you have on a mote don't look like what is inside
> time.h anyway.
>
> I assume you have two TMillis that you are subtracting. Where are you
> getting your times anyway
> and what do they look like?
>
> eric
>
> >
> >
> >
> >
> > --
> > View this message in context:
> > http://tinyos-help.10906.n7.nabble.com/Use-time-h-in-nesC-applications-tp23747.html
> > Sent from the TinyOS - Help mailing list archive at Nabble.com
> > (http://Nabble.com).
> > _______________________________________________
> > Tinyos-help mailing list
> > [hidden email] (/user/SendEmail.jtp?type=node&node=23755&i=1)
> > https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help
>
>
>
> --
> Eric B. Decker
> Senior (over 50 :-) Researcher
>
>
> _______________________________________________
> Tinyos-help mailing list
> [hidden email] (/user/SendEmail.jtp?type=node&node=23755&i=2)
> https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help
>
> If you reply to this email, your message will be added to the discussion
> below:
> http://tinyos-help.10906.n7.nabble.com/Use-time-h-in-nesC-applications-tp23747p23755.html
>
> To unsubscribe from Use time.h in nesC applications, click here
> (http://tinyos-help.10906.n7.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=23747&code=anBnYW1hcmFsQGdtYWlsLmNvbXwyMzc0N3wtMTc2ODc3OTgy).
> NAML
> (http://tinyos-help.10906.n7.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml)
>
--
View this message in context:
http://tinyos-help.10906.n7.nabble.com/Use-time-h-in-nesC-applications-tp23747p23759.html
Sent from the TinyOS - Help mailing list archive at Nabble.com.
_______________________________________________
Tinyos-help mailing list
[email protected]
https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help