I found a way to get UTC time and calculate local! Thanks to all
{$if Defined(FPC) and Defined(UNIX)}
const
libc = 'libc.so';
type
tm = packed record
tm_sec: Integer; // Seconds. [0-60] (1 leap second)
tm_min: Integer; // Minutes. [0-59]
tm_hour: Integer; // Hours.[0-23]
tm_mday: Integer; // Day.[1-31]
tm_mon: Integer; // Month.[0-11]
tm_year: Integer; // Year since 1900
tm_wday: Integer; // Day of week [0-6] (Sunday = 0)
tm_yday: Integer; // Days of year [0-365]
tm_isdst: Integer; // Daylight Savings flag [-1/0/1]
tm_gmtoff: Integer; // Seconds east of UTC
tm_zone: PAnsiChar; // Timezone abbreviation
end;
Ptm = ^tm;
function localtime(var Timer: time_t): Ptm; cdecl; external libc name 'localtime';
{$ifend}
class function TOSTime.UpdateLocalDelta: Int64;
{$ifdef MSWINDOWS}
var
LUTCTime: TFileTime;
LLocalTime: TFileTime;
begin
GetSystemTimeAsFileTime(LUTCTime);
FileTimeToLocalFileTime(LUTCTime, LLocalTime);
Result := Int64(LLocalTime) - Int64(LUTCTime);
TIMESTAMP_LOCAL_DELTA := Result;
end;
{$else .POSIX}
var
Ltm: Ptm;
LUtcTime: timespec;
LLocalTime: time_t;
begin
clock_gettime(CLOCK_REALTIME_COARSE, @LUtcTime);
Ltm := localtime(LUtcTime.tv_sec);
LLocalTime := Ltm.tm_sec + Ltm.tm_min * 60 + Ltm.tm_hour * 3600 + Ltm.tm_yday * 86400 +
(Ltm.tm_year - 70) * 31536000 + ((Ltm.tm_year - 69) div 4) * 86400 -
((Ltm.tm_year - 1) div 100) * 86400 + ((Ltm.tm_year + 299) div 400) * 86400;
Result := (LLocalTime - LUtcTime.tv_sec) * TIMESTAMP_SECOND;
TIMESTAMP_LOCAL_DELTA := Result;
TIMESTAMP_REALTIMESTAMP_LOCAL_DELTA := TIMESTAMP_REALTIME_DELTA + Result;
end;
{$endif}