Skip to content

Commit e79685c

Browse files
committed
shell: move date_service to sys_clock api
move date_service from posix api to sys_clock api. Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
1 parent 732a3a5 commit e79685c

File tree

2 files changed

+3
-10
lines changed

2 files changed

+3
-10
lines changed

subsys/shell/modules/Kconfig

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ config DEVICE_SHELL
1111

1212
config DATE_SHELL
1313
bool "Date shell"
14-
depends on POSIX_TIMERS
1514
default y if !SHELL_MINIMAL
1615
help
1716
This shell provides access to date and time based on Unix time.

subsys/shell/modules/date_service.c

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,6 @@
1313

1414
#include <zephyr/sys/timeutil.h>
1515

16-
#if defined(CONFIG_ARCH_POSIX) && defined(CONFIG_EXTERNAL_LIBC)
17-
#include <time.h>
18-
#else
19-
#include <zephyr/posix/time.h>
20-
#endif
21-
2216
#define HELP_NONE "[none]"
2317
#define HELP_DATE_SET "[Y-m-d] <H:M:S>"
2418

@@ -144,7 +138,7 @@ static int cmd_date_set(const struct shell *sh, size_t argc, char **argv)
144138
struct tm tm;
145139
int ret;
146140

147-
clock_gettime(CLOCK_REALTIME, &tp);
141+
sys_clock_gettime(SYS_CLOCK_REALTIME, &tp);
148142

149143
gmtime_r(&tp.tv_sec, &tm);
150144

@@ -177,7 +171,7 @@ static int cmd_date_set(const struct shell *sh, size_t argc, char **argv)
177171
}
178172
tp.tv_nsec = 0;
179173

180-
ret = clock_settime(CLOCK_REALTIME, &tp);
174+
ret = sys_clock_settime(SYS_CLOCK_REALTIME, &tp);
181175
if (ret != 0) {
182176
shell_error(sh, "Could not set date %d", ret);
183177
return -EINVAL;
@@ -193,7 +187,7 @@ static int cmd_date_get(const struct shell *sh, size_t argc, char **argv)
193187
struct timespec tp;
194188
struct tm tm;
195189

196-
clock_gettime(CLOCK_REALTIME, &tp);
190+
sys_clock_gettime(SYS_CLOCK_REALTIME, &tp);
197191

198192
gmtime_r(&tp.tv_sec, &tm);
199193

0 commit comments

Comments
 (0)