Skip to content

Commit

Permalink
mgmt: mcumgr: os_mgmt: fix millisecond return
Browse files Browse the repository at this point in the history
Ensure that leading zeros are present in the milliseconds field,
otherwise a milliseconds count of 35 will appear as x.35, i.e. 350
milliseconds. With this fix, it will appear as x.035.

Signed-off-by: Jordan Yates <jordan@embeint.com>
  • Loading branch information
JordanYates authored and nashif committed Sep 4, 2024
1 parent e6dc930 commit 652839a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 2 additions & 0 deletions doc/releases/release-notes-4.0.rst
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,8 @@ Libraries / Subsystems

* Added support for :ref:`mcumgr_smp_group_10`, which allows for listing information on
supported groups.
* Fixed formatting of milliseconds in :c:enum:`OS_MGMT_ID_DATETIME_STR` by adding
leading zeros.

* Logging

Expand Down
2 changes: 1 addition & 1 deletion subsys/mgmt/mcumgr/grp/os_mgmt/src/os_mgmt.c
Original file line number Diff line number Diff line change
Expand Up @@ -836,7 +836,7 @@ static int os_mgmt_datetime_read(struct smp_streamer *ctxt)

sprintf(date_string, "%4d-%02d-%02dT%02d:%02d:%02d"
#ifdef CONFIG_MCUMGR_GRP_OS_DATETIME_MS
".%d"
".%03d"
#endif
, (uint16_t)(current_time.tm_year + RTC_DATETIME_YEAR_OFFSET),
(uint8_t)(current_time.tm_mon + RTC_DATETIME_MONTH_OFFSET),
Expand Down

0 comments on commit 652839a

Please sign in to comment.