So I have a Time Clock program that we built that has been having some issues, so I looked and found that some of the queries were inserting into DB2 Logicals (which is like an Indexed table). So I changed the queries to insert and use the Physical files. That was the only change to the program.
Now this section of code fails every time:
and I get the message 'Server time is not available. Notify Information Technology'.
I can see that Result has a value BEFORE the Except statement. But as soon as it gets to IdSNTP1.Active Result is reset to 0. Now this code has worked in previous versions and I'm not sure what I've done that's broken it!
I used the GetVersion property of the component and it says 8.0.25. I dropped a new IdSNTP component on the form and it also has the same Version, so I don't think that's the issue.
Any help appreciated!
Thanks,
Leslie
Now this section of code fails every time:
Code:
function TForm_MainClockIt.ServerDateTime: TDateTime;
begin
//Result:= Now; // unremark this to get time from local pc instead of
//Exit; // from the server.
// NOTE: this function will always return 0 if Delphi IDE has not been updated
// with later version of the Indy components. (no change is needed on the
// user PCs). See comments at the top of this unit. rgh
Try
Result:= IdSNTP1.DateTime;
IdSNTP1.Active:= False;
Except
IdSNTP1.Active:= False;
Beep;
MessageDlg('Can''t get correct time from Server.' + #13 +
'Try restarting the program, or' + #13 +
'notify your Supervisor.', mtWarning, [mbOk], 0);
Application.Terminate;
End;
if Result = 0
then
begin
Beep;
Result:= Now;
MessageDlg('Server time is not available.' + #13#13 +
'Notify Information Technology.', mtWarning, [mbOk], 0);
end;
end;
I can see that Result has a value BEFORE the Except statement. But as soon as it gets to IdSNTP1.Active Result is reset to 0. Now this code has worked in previous versions and I'm not sure what I've done that's broken it!
I used the GetVersion property of the component and it says 8.0.25. I dropped a new IdSNTP component on the form and it also has the same Version, so I don't think that's the issue.
Any help appreciated!
Thanks,
Leslie