The LIBC_ALLOW_LESS_THAN_64BIT_TIME option disables a compile-time check ensuring that time_t can hold 64-bit values. This check can prevent accidental builds on targets with 32-bit time_t and the consequent 2038 issues. This option is enabled when using the native C library as i386 glibc uses 32-bit time_t. A new file, validate_libc.c, is added to lib/libc to contain this and any future libc tests. The check for CONFIG_EXTERNAL_LIBC is moved to libc/CMakeLists.txt to ensure that this new file is always compiled. Signed-off-by: Keith Packard <keithp@keithp.com>
19 lines
433 B
C
19 lines
433 B
C
/*
|
|
* Copyright © 2025 Keith Packard <keithp@keithp.com>
|
|
*
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
*/
|
|
|
|
#include <zephyr/kernel.h>
|
|
#include <zephyr/toolchain.h>
|
|
|
|
/* Validate various C library implementation characteristics */
|
|
|
|
#ifndef CONFIG_LIBC_ALLOW_LESS_THAN_64BIT_TIME
|
|
#include <time.h>
|
|
/*
|
|
* Ensure that time_t can hold at least 64 bit values.
|
|
*/
|
|
BUILD_ASSERT(sizeof(time_t) >= 8, "time_t cannot hold 64-bit values");
|
|
#endif
|