drivers rtc: Do not treat the host libC differently

This code was using strptime from the C library in some cases,
but this function is an extension which many embedded libCs do
not provide, and which is not provided by default unless
_XOPEN_SOURCE or a similar macro is defined before the system headers
are included.

We could define _XOPEN_SOURCE for the libraries that provide it,
but instead of treating the host C library differently than
embedded libraries, let's just build the provided version always,
as that should provide better coverage of this code.

Note: It seems picolibc's strptime is broken,
until this very recent patch:
https://github.com/picolibc/picolibc/pull/657
so we should not select it when building for this library
for a while either.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
This commit is contained in:
Alberto Escolar Piedras 2023-12-28 12:21:00 +01:00 committed by Anas Nashif
commit 7369bb56e3

View file

@ -16,8 +16,6 @@ static const char format_iso8601[] = "%FT%T";
static const char format_time[] = "%T"; /* hh:mm:ss */
static const char format_date[] = " %F"; /* yyyy-mm-dd */
#if !defined CONFIG_BOARD_NATIVE_POSIX
static const char *consume_chars(const char *s, char *dest, unsigned int cnt)
{
if (strlen(s) < cnt) {
@ -148,8 +146,6 @@ static char *strptime(const char *s, const char *format, struct tm *tm_time)
}
}
#endif
static int cmd_set(const struct shell *sh, size_t argc, char **argv)
{
const struct device *dev = device_get_binding(argv[1]);