Skip to content

Commit d78e477

Browse files
lucasAbadFrlum1n0us
authored andcommitted
fix(zephyr): Real os_timespec definition with comments
1 parent 6d79053 commit d78e477

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
@@ -301,7 +301,24 @@ typedef unsigned int os_nfds_t;
301301

302302
#define FIONREAD ZFD_IOCTL_FIONREAD
303303

304-
typedef struct timespec os_timespec;
304+
/*
305+
* The previous `os_timespec` was a forward declaration:
306+
*
307+
* typedef struct timespec os_timespec;
308+
*
309+
* It was not bad as is, but seemed to not be included from anywhere.
310+
* As of Zephyr v3.7.0 (LTS) the `timespec` struct is only declared with the
311+
* configuration `CONFIG_POSIX_API` enabled which is not a prefered
312+
* configuration for the Zephyr port.
313+
*
314+
* NOTE: If Zephyr later exposes `struct timespec` without requiring
315+
* CONFIG_POSIX_API, this definition should be replaced by an alias.
316+
*/
317+
typedef struct {
318+
int64_t tv_sec;
319+
long tv_nsec;
320+
} os_timespec;
321+
305322

306323
#ifndef CLOCK_REALTIME
307324
#define CLOCK_REALTIME 1

0 commit comments

Comments
 (0)