On Wed, Oct 30, 2013 at 2:59 PM, João Amaral <[email protected]> wrote:
> What problem are you trying to solve?
>
> I need to be able to pinpoint two time instants. I’m writing a rule-based
> NIDS.
>
what is 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)
>
okay. my opinion is time_t is way over kill for this.
TMilli is a 32 bit number being ticked once per millisec (although you have
to be care to differentiate between binary and decimal millisecs, its
confusing and matters). At this point binary vs. decimal timebases is a
platform dependency. But it probably needs to be decimal millisecs for
various reasons.
Anyway, TMilli(mis, binary millisecs) has 1/1024 ticks in a second. And
rolls over in
4,294,967,296/1024/60/60/24 = 48.545 days.
if ms (decimal millisecs) are being used we have
4,294,967,296/1000/60/60/24 = 49.710 days
So I'd recommend staying with a simple 32 bit time value (TMilli) depending
on your event horizon as well as your time epoch (where it wraps).
> 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.
>
except it is very problematic.
>
> 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]<http://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.
> _______________________________________________
> Tinyos-help mailing list
> [hidden email] <http://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] <http://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.
> 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: Re: Use time.h in nesC
> applications<http://tinyos-help.10906.n7.nabble.com/Use-time-h-in-nesC-applications-tp23747p23759.html>
> Sent from the TinyOS - Help mailing list
> archive<http://tinyos-help.10906.n7.nabble.com/>at Nabble.com.
>
> _______________________________________________
> Tinyos-help mailing list
> [email protected]
> https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help
>
--
Eric B. Decker
Senior (over 50 :-) Researcher
_______________________________________________
Tinyos-help mailing list
[email protected]
https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help