|Top Previous Next|
Sometimes it is necessary to remember the date/time of the most recent setting modification. This can be useful, for instance, when synchronizing settings between several devices.
To enable timestamps, click (enable) the Timestamp option in the configurator. Timestamps occupy an additional 7 bytes of memory for each setting (in the EEPROM, flash disk file, or in RAM, depending on how the setting is stored). This is why timestamps are disabled by default.
There is a single timestamp for each setting, even if this setting includes multiple members. Timestamps are read and written through the stg_timestamp global variable. Note that it is the responsibility of your application to set and interpret timestamps. The STG library does not access the real-time clock of your system and does not verify the contents of stg_timestamp variable.
You can also set just the timestamp, without altering setting value:
Stg_timestamp variable is updated every time you read the setting with stg_get() or stg_sg(,,,EN_STG_GET). In the following example, we read the setting in order to get its timestamp, then set new setting value if the setting hasn't been yet modified today: