I think you have the wrong format specifier argument. Try %ld instead of %f. Try using dbg("Boot", "Function took %ld millisecs\n", (ts1 - ts) );
On Sat, Dec 7, 2013 at 6:53 AM, nivedita datta <sweetniv...@gmail.com>wrote: > I am trying to calculate the time taken by a function that I wrote. I am > using the component LocalTimeMilliC to do this. I have added the > following lines to the configuration file: > > *components LocalTimeMilliC; > TestC.LocalTime -> LocalTimeMilliC;* > > ...and in the module section of the implementation: > > *uses interface LocalTime<TMilli>;* > > ...and in the code: > > *uint32_t timestamp, timestamp1;**timestamp = call LocalTime.get(); > **... > function called here ... > ... > timestamp1 = call LocalTime.get(); > dbg("Boot", "Function took %f millisecs\n", (ts1 - ts) ); > * > > However, it always prints the value as 0.000000 millisecs. Please let me know > what am I doing wrong in this code or if there is a > better method to calculate the time taken for execution of a function. > Thanks for your time & effort. > Regards, Nivedita Datta > > > > _______________________________________________ > Tinyos-help mailing list > Tinyos-help@millennium.berkeley.edu > https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help >
_______________________________________________ Tinyos-help mailing list Tinyos-help@millennium.berkeley.edu https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help