Contiki difference between RTIMER_NOW() and clock_time()

末鹿安然 提交于 2019-12-06 11:34:18

The two functions:

  • RTIMER_NOW() - returns the uptime in real-time timer (rtimer) ticks modulo rtimer overflow value. For example, on a platforms where RTIMER_ARCH_SECOND is 32768 and the overflow happens every 2 seconds, the value will always be between 0 and 65535, inclusive.

  • clock_time() - returns the uptime in clock ticks. Unlike the rtimer ticks, these are monotonic (that is, always nondecreasing). By default there are 128 ticks per second (the constant CLOCK_SECOND defines this).

Your other questions:

  1. Use uint32_t, then values will always fit in a 32-bit integer. Otherwise on platforms where int is 16 bits, values of type rtimer_ticks_t and/or clock_time_t might not fit in it.

  2. How do you possibly think that would work? What is the vaulue of "simulation time" when the code is executing on real nodes? The answer is no, the emulated nodes in Cooja have no idea about the "simulation time".

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!