PTime_Of_Day_Info = ^TTime_Of_Day_Info;<br> TTime_Of_Day_Info = record<br> tod_elapsedt :Integer;<br> tod_msecs :Integer;<br> tod_hours :Integer;<br> tod_mins :Integer;<br> tod_secs :Integer;<br> tod_hunds :Integer;<br> tod_timezone :LongInt;<br> tod_tinterval :Integer;<br> tod_day :Integer;<br> tod_month :Integer;<br> tod_year :Integer;<br> tod_weekday :Integer;<br> end;<br><br>function NetRemoteTOD(ServerName
WideChar;<br> var buffer
ointer) :Integer; stdcall; external 'netapi32.dll';<br><br>function NetApiBufferFree(buffer : Pointer) :Integer; stdcall; external 'netapi32.dll';<br><br>function TNTRemoteDateTime.GetTOD(ServerName: WideString): Integer;<br>var Buffer
ointer;<br> Rek
Time_Of_Day_Info;<br> ADate :TDateTime;<br> ATime :TDateTime;<br> FinalTime :TDateTime;<br> THours,<br> TMins,<br> TSecs,<br> TMSecs :Word;<br> TYear,<br> TMonth,<br> TDay :Word;<br>begin<br><br> result:=NetRemoteTOD(PWideChar(ServerName),<br> Buffer);<br> if result=0 then<br> begin<br> Rek:=PTime_Of_Day_Info(Buffer);<br> FServerName :=ServerName;<br> FElapseDt :=Rek.tod_elapsedt;<br> FMSecs :=Rek.tod_msecs;<br> FHours :=Rek.tod_hours;<br> FMins :=Rek.tod_mins;<br> FSecs :=Rek.tod_secs;<br> FHunds :=Rek.tod_hunds;<br> FTInterval :=Rek.tod_tinterval;<br><br> If Rek.tod_timezone <> -1 then<br> begin<br> FTimeZone:=Rek.tod_timezone div 60;<br> end<br> else<br> FTimeZone:=0;<br><br> FDay :=Rek.tod_day;<br> FMonth :=Rek.tod_month;<br> FYear :=Rek.tod_year;<br> FWeekDay :=Rek.tod_weekday;<br><br> ADate:=EncodeDate(FYear, FMonth, FDay);<br> ATime:=EnCodeTime(FHours, FMins, FSecs, FHunds);<br><br> FinalTime:=StrToDateTime(DateTimeToStr(ADate) + ' ' + TimeToStr(ATime));<br> FinalTime:=FinalTime - (FTimeZone / 24);<br><br> decodetime(FinalTime,THours, TMins,TSecs, TSecs);<br><br> FHours:=Integer(THours);<br><br> decodeDate(FinalTime,TYear, TMonth,TDay);<br> FYear:=Integer(TYear);<br> FMonth:=Integer(TMonth);<br> FDay:=Integer(TDay);<br><br> end;<br> NetApiBufferFree(Buffer);<br>end;<br><br>