Skip to content

Commit 843b205

Browse files
committed
fill in dst & timezone
1 parent 0355101 commit 843b205

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

modules/base/time/zephyr/modTime.c

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2025 Moddable Tech, Inc.
2+
* Copyright (c) 2025-2026 Moddable Tech, Inc.
33
*
44
* This file is part of the Moddable SDK Runtime.
55
*
@@ -28,29 +28,28 @@ void xs_time_set(xsMachine *the)
2828
{
2929
struct timespec ts = { .tv_sec = xsmcToInteger(xsArg(0)) };
3030
sys_clock_settime(SYS_CLOCK_REALTIME, &ts);
31-
32-
ts.tv_sec = 0;
33-
sys_clock_gettime(SYS_CLOCK_REALTIME, &ts);
3431
}
3532

3633
void xs_time_timezone_get(xsMachine *the)
3734
{
38-
xsUnknownError("unimplemented");
35+
xsmcSetInteger(xsResult, modGetTimeZone());
3936
}
4037

4138
void xs_time_timezone_set(xsMachine *the)
4239
{
43-
xsUnknownError("unimplemented");
40+
int32_t seconds = xsmcToInteger(xsArg(0));
41+
modSetTimeZone(seconds);
4442
}
4543

4644
void xs_time_dst_get(xsMachine *the)
4745
{
48-
xsUnknownError("unimplemented");
46+
int32_t seconds = xsmcToInteger(xsArg(0));
47+
modSetDaylightSavingsOffset(seconds);
4948
}
5049

5150
void xs_time_dst_set(xsMachine *the)
5251
{
53-
xsUnknownError("unimplemented");
52+
xsmcSetInteger(xsResult, modMilliseconds());
5453
}
5554

5655
void xs_time_ticks(xsMachine *the)

0 commit comments

Comments
 (0)