feat: add time offset configuration
This commit is contained in:
@@ -116,6 +116,10 @@ namespace Montauk {
|
||||
// Power management
|
||||
static constexpr uint64_t SYS_SUSPEND = 89;
|
||||
|
||||
// Timezone
|
||||
static constexpr uint64_t SYS_SETTZ = 90;
|
||||
static constexpr uint64_t SYS_GETTZ = 91;
|
||||
|
||||
// Audio control commands (for SYS_AUDIOCTL)
|
||||
static constexpr int AUDIO_CTL_SET_VOLUME = 0;
|
||||
static constexpr int AUDIO_CTL_GET_VOLUME = 1;
|
||||
|
||||
@@ -52,6 +52,7 @@ struct DesktopSettings {
|
||||
bool show_shadows; // window shadows on/off
|
||||
bool clock_24h; // 24-hour clock format
|
||||
int ui_scale; // 0=Small, 1=Default, 2=Large
|
||||
int tz_offset_minutes; // timezone offset from UTC in minutes
|
||||
};
|
||||
|
||||
struct DesktopState {
|
||||
|
||||
@@ -94,6 +94,8 @@ extern "C" {
|
||||
#define MTK_SYS_AUDIOCLOSE 81
|
||||
#define MTK_SYS_AUDIOWRITE 82
|
||||
#define MTK_SYS_AUDIOCTL 83
|
||||
#define MTK_SYS_SETTZ 90
|
||||
#define MTK_SYS_GETTZ 91
|
||||
|
||||
#define MTK_SOCK_TCP 1
|
||||
#define MTK_SOCK_UDP 2
|
||||
@@ -411,6 +413,14 @@ static inline void mtk_gettime(mtk_datetime *out) {
|
||||
_mtk_syscall1(MTK_SYS_GETTIME, (long)out);
|
||||
}
|
||||
|
||||
static inline void mtk_settz(int offset_minutes) {
|
||||
_mtk_syscall1(MTK_SYS_SETTZ, (long)offset_minutes);
|
||||
}
|
||||
|
||||
static inline int mtk_gettz(void) {
|
||||
return (int)_mtk_syscall0(MTK_SYS_GETTZ);
|
||||
}
|
||||
|
||||
/* ====================================================================
|
||||
System info
|
||||
==================================================================== */
|
||||
|
||||
@@ -249,6 +249,10 @@ namespace montauk {
|
||||
// Timekeeping (wall-clock)
|
||||
inline void gettime(Montauk::DateTime* out) { syscall1(Montauk::SYS_GETTIME, (uint64_t)out); }
|
||||
|
||||
// Timezone offset (total minutes from UTC)
|
||||
inline void settz(int offset_minutes) { syscall1(Montauk::SYS_SETTZ, (uint64_t)(int64_t)offset_minutes); }
|
||||
inline int gettz() { return (int)syscall0(Montauk::SYS_GETTZ); }
|
||||
|
||||
// Random number generation
|
||||
inline int64_t getrandom(void* buf, uint32_t len) {
|
||||
return syscall2(Montauk::SYS_GETRANDOM, (uint64_t)buf, (uint64_t)len);
|
||||
|
||||
Reference in New Issue
Block a user