-
Notifications
You must be signed in to change notification settings - Fork 6.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
posix: clock: clock_gettime() should not be a syscall
We try to implement Zephyr's POSIX API as regular library functions, so remove the __syscall annotation from clock_gettime() and implement the syscall portion of it under the hood. This also adds a bit of a micro-optimization in that we can do a lot of processing outside of the system call. In fact, processing CLOCK_MONOTONIC likely does not require any syscall other than k_uptime_ticks(). Signed-off-by: Christopher Friedt <cfriedt@meta.com>
- Loading branch information
1 parent
e0383a6
commit 95a22b1
Showing
4 changed files
with
56 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
/* | ||
* Copyright (c) 2023, Meta | ||
* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
#ifndef ZEPHYR_LIB_POSIX_POSIX_CLOCK_H_ | ||
#define ZEPHYR_LIB_POSIX_POSIX_CLOCK_H_ | ||
|
||
#include <time.h> | ||
|
||
#include <zephyr/kernel.h> | ||
#include <zephyr/posix/posix_types.h> | ||
|
||
__syscall int __posix_clock_get_base(clockid_t clock_id, struct timespec *ts); | ||
|
||
#include <syscalls/posix_clock.h> | ||
|
||
#endif |