mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-29 23:00:13 +02:00
+ implemented SysUtils.GetLocalTime for WASI
This commit is contained in:
parent
00d4a6889d
commit
0934df505c
@ -667,8 +667,20 @@ end;
|
|||||||
{$I tzenv.inc}
|
{$I tzenv.inc}
|
||||||
|
|
||||||
Procedure GetLocalTime(var SystemTime: TSystemTime);
|
Procedure GetLocalTime(var SystemTime: TSystemTime);
|
||||||
|
var
|
||||||
|
NanoSecsPast: __wasi_timestamp_t;
|
||||||
begin
|
begin
|
||||||
end ;
|
if __wasi_clock_time_get(__WASI_CLOCKID_REALTIME,1000000,@NanoSecsPast)=__WASI_ERRNO_SUCCESS then
|
||||||
|
begin
|
||||||
|
EpochToLocal(NanoSecsPast div 1000000000,
|
||||||
|
SystemTime.Year,SystemTime.Month,SystemTime.Day,
|
||||||
|
SystemTime.Hour,SystemTime.Minute,SystemTime.Second);
|
||||||
|
SystemTime.MilliSecond := (NanoSecsPast div 1000000) mod 1000;
|
||||||
|
SystemTime.DayOfWeek := DayOfWeek(EncodeDate(SystemTime.Year,SystemTime.Month,SystemTime.Day))-1;
|
||||||
|
end
|
||||||
|
else
|
||||||
|
FillChar(SystemTime,SizeOf(SystemTime),0);
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
{****************************************************************************
|
{****************************************************************************
|
||||||
|
Loading…
Reference in New Issue
Block a user