12-27-2023 06:52 AM
With the BSEC2 library, a timestamp in nanoseconds is required to be provided for each sensor measurement. The documentation says that it is fine if this is a value that starts at zero and is increased over time. Must this value remain consistent during power cycles, when the state is re-loaded from flash into the system, or can the timestamps start back at zero in this case? I ask as I am working on a project that will likely experience occasional power interruptions, but I do not have a way to maintain a clock between these interruptions.
Here is an example scenario (note that I am using smaller numbers for the timestamp, to keep it simple).
Is this allowed, must the timing be preserved after power loss, so that the post-power loss samples are values greater than 10 (which would thus require me to integrate an external method for keeping track of time)?
Solved! Go to Solution.
12-27-2023 07:51 AM
Hi marsfan,
When the state is reloaded from flash memory into the system, the timestamp can start from zero. But we recommend using the real-time time of RTC as the time stamp of BSEC, without worrying about whether the current device is powered on or restarted, because even if the system loses power, the RTC time can still be updated normally.