%ld is for signed int, use %lu for unsigned long int.
Cheers, Thomas On Fri, Nov 13, 2009 at 8:01 AM, Robert Smith <robby_smith...@yahoo.com> wrote: > Thank you. > > I didn't cast the return value, so I'm geussing I misused printf. > I did "printf("%ld", call Counter.get());". I checked TestPrintfC.nc of > tutorial/Printf, and it uses %ld for uint32_t, so I assumed %ld is for > uin32_t format. Can anyone tell if I am using printf correctly? > > Best Regards, > Rob > > ________________________________ > Who says it's negative? > > When a signed integer's top bit gets set it "becomes" negative. > Somewhere along the way your unsigned variable is being mis-interpreted. > Often the default behavior is signed, so make sure you are using the > right declarations and casts. > > Java doesn't know from unsigned, so the negative might be an artifact > of your tracing technique. > > MS > > > Robert Smith wrote: >> Hi, >> >> I am currently using TinyOS2.x, and tyring to use microseconds in mica >> platform. >> I used CounterMicro32C to get microsec counter, and after awhile, the >> return value becomes negative value. >> CounterMicro32C provides interface Counter with uint32_t format, but why >> am I getting negative values from this? >> >> Best Regards, >> Rob >> >> >> ------------------------------------------------------------------------ >> >> _______________________________________________ >> 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 > _______________________________________________ Tinyos-help mailing list Tinyos-help@millennium.berkeley.edu https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help