[orbis-kernel] Fix sys_gettimeofday

Disable sys_utc_to_localtime and sys_localtime_to_utc for now.
Libkernel will fallback to sys_gettimeofday.
This commit is contained in:
Ivan Chikish 2023-07-15 06:03:55 +03:00
parent 1d4b96b3de
commit 86d059ddd1
3 changed files with 11 additions and 3 deletions

View file

@ -12,7 +12,7 @@ struct timeval {
int64_t tv_usec;
};
struct timezone {
sint tz_minuteswest;
sint tz_mineast;
sint tz_dsttime;
};
struct timesec {

View file

@ -857,6 +857,10 @@ orbis::SysResult orbis::sys_utc_to_localtime(Thread *thread, int64_t time,
int64_t *localtime,
orbis::timesec *_sec,
int *_dst_sec) {
// Disabled for now
thread->retval[0] = (int)ErrorCode::RANGE;
return {};
ORBIS_LOG_TRACE(__FUNCTION__, time, localtime, _sec, _dst_sec);
struct ::tm tp;
auto result = ::mktime(::localtime_r(&time, &tp));
@ -870,6 +874,10 @@ orbis::SysResult orbis::sys_localtime_to_utc(Thread *thread, int64_t time,
uint unk, int64_t *ptime,
orbis::timesec *_sec,
int *_dst_sec) {
// Disabled for now
thread->retval[0] = (int)ErrorCode::RANGE;
return {};
ORBIS_LOG_TRACE(__FUNCTION__, time, unk, ptime, _sec, _dst_sec);
struct ::tm tp;
::time_t timez = 0;

View file

@ -130,8 +130,8 @@ orbis::SysResult orbis::sys_gettimeofday(Thread *thread, ptr<orbis::timeval> tp,
if (localtime_r(&tv.tv_sec, &tp) != &tp)
std::abort();
orbis::timezone value;
value.tz_dsttime = tp.tm_isdst;
value.tz_minuteswest = -tp.tm_gmtoff / 60;
value.tz_dsttime = 0; // TODO
value.tz_mineast = tp.tm_gmtoff / 60;
if (auto e = uwrite(tzp, value); e != ErrorCode{})
return e;
}