From 37fd7de4fb2b631e99fa732e3161f71172343c03 Mon Sep 17 00:00:00 2001 From: Sertonix Date: Thu, 21 Aug 2025 04:20:06 +0200 Subject: [PATCH] Always use timegm() declaration from libc headers It seems like the only part missing to use the libc provided one was to define _DEFAULT_SOURCE. Otherwise on 32-bit musl-libc the function declaration would be incorrect, causing a 32-bit time_t compat function to be called. Signed-off-by: Sertonix --- source/posix/time.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/source/posix/time.c b/source/posix/time.c index dd49d6b0b..c5aff559a 100644 --- a/source/posix/time.c +++ b/source/posix/time.c @@ -2,6 +2,9 @@ * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. * SPDX-License-Identifier: Apache-2.0. */ + +// For timegm() on glibc/musl +#define _DEFAULT_SOURCE #include #if defined(__ANDROID__) && !defined(__LP64__) @@ -59,11 +62,6 @@ time_t aws_timegm(struct tm *const t) { #else -# ifndef __APPLE__ -/* glibc.... you disappoint me.. */ -extern time_t timegm(struct tm *); -# endif - time_t aws_timegm(struct tm *const t) { return timegm(t); }