Skip to content

Commit c8a7f00

Browse files
committed
fix(zephyr): Real os_timespec definition with comments
1 parent 45acd9f commit c8a7f00

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

core/shared/platform/zephyr/platform_internal.h

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,24 @@ typedef unsigned int os_nfds_t;
281281

282282
#define FIONREAD ZFD_IOCTL_FIONREAD
283283

284-
typedef struct timespec os_timespec;
284+
/*
285+
* The previous `os_timespec` was a forward declaration:
286+
*
287+
* typedef struct timespec os_timespec;
288+
*
289+
* It was not bad as is, but seemed to not be included from anywhere.
290+
* As of Zephyr v3.7.0 (LTS) the `timespec` struct is only declared with the
291+
* configuration `CONFIG_POSIX_API` enabled which is not a prefered
292+
* configuration for the Zephyr port.
293+
*
294+
* NOTE: If Zephyr later exposes `struct timespec` without requiring
295+
* CONFIG_POSIX_API, this definition should be replaced by an alias.
296+
*/
297+
typedef struct {
298+
int64_t tv_sec;
299+
long tv_nsec;
300+
} os_timespec;
301+
285302

286303
#ifndef CLOCK_REALTIME
287304
#define CLOCK_REALTIME 1

0 commit comments

Comments
 (0)