Skip to content

Commit e141dda

Browse files
committed
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 <sertonix@posteo.net>
1 parent cde20c6 commit e141dda

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

source/posix/time.c

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
33
* SPDX-License-Identifier: Apache-2.0.
44
*/
5+
6+
// For timegm() on glibc/musl
7+
#define _DEFAULT_SOURCE
58
#include <aws/common/time.h>
69

710
#if defined(__ANDROID__) && !defined(__LP64__)
@@ -59,11 +62,6 @@ time_t aws_timegm(struct tm *const t) {
5962

6063
#else
6164

62-
# ifndef __APPLE__
63-
/* glibc.... you disappoint me.. */
64-
extern time_t timegm(struct tm *);
65-
# endif
66-
6765
time_t aws_timegm(struct tm *const t) {
6866
return timegm(t);
6967
}

0 commit comments

Comments
 (0)