You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@nuttx.apache.org by Petro Karashchenko <pe...@gmail.com> on 2022/03/27 13:08:48 UTC
mktime() does not "normalize" struct tm argument
Hello team,
Recently I've been reviewing "strftime()" implementation from
"libs/libc/time/lib_strftime.c" and found interesting lines:
/* %s: The number of seconds since the Epoch, that is,
* since 1970-01-01 00:00:00 UTC.
* Hmmm... mktime argume is not 'const'.
*/
case 's':
{
len = snprintf(dest, chleft, "%ju",
(uintmax_t)mktime((FAR struct tm *)tm));
}
break;
This led me to the "mktime()" implementation and I found out that the NuttX
version of "mktime()" does not "normalize" struct tm argument. Is that a
designed behavior or this is a bug?
Best regards,
Petro