function SystemDateTime (tDate: TDateTime; tTime: TDateTime): Boolean;
var
tSetDate: TDateTime;
vDateBias: Variant;
tSetTime: TDateTime;
vTimeBias: Variant;
tTZI: TTimeZoneInformation;
tST: TSystemTime;
begin
GetTimeZoneInformation(tTZI);
vDateBias := tTZI.Bias / 1440;
tSetDate := tDate + vDateBias;
vTimeBias := tTZI.Bias / 1440;
tSetTime := tTime + vTimeBias;
with tST do
begin
wYear := StrToInt(FormatDateTime('yyyy', tSetDate));
wMonth := StrToInt(FormatDateTime('mm', tSetDate));
wDay := StrToInt(FormatDateTime('dd', tSetDate));
wHour := StrToInt(FormatDateTime('hh', tSettime));
wMinute := StrToInt(FormatDateTime('nn', tSettime));
wSecond := StrToInt(FormatDateTime('ss', tSettime));
wMilliseconds := 0;
end;
SystemDateTime := SetSystemTime(tST);
end;
Nenhum comentário:
Postar um comentário