TimeClient.pas 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. { $HDR$}
  2. {**********************************************************************}
  3. { Unit archived using Team Coherence }
  4. { Team Coherence is Copyright 2002 by Quality Software Components }
  5. { }
  6. { For further information / comments, visit our WEB site at }
  7. { http://www.TeamCoherence.com }
  8. {**********************************************************************}
  9. {}
  10. { $Log: 13712: TimeClient.pas
  11. {
  12. Rev 1.1 4/5/2003 3:40:38 PM BGooijen
  13. Now uses another host
  14. }
  15. {
  16. { Rev 1.0 11/13/2002 04:01:42 PM JPMugaas
  17. }
  18. unit TimeClient;
  19. interface
  20. uses
  21. IndyBox;
  22. type
  23. TTimeClient = class(TIndyBox)
  24. public
  25. procedure Test; override;
  26. end;
  27. implementation
  28. uses
  29. IdTime,
  30. SysUtils;
  31. const
  32. // List of time servers available at:
  33. // http://www.eecis.udel.edu/~mills/ntp/servers.htm
  34. GTimeHost = 'clock.psu.edu'; //'ntp.marine.csiro.au';
  35. { TTimeClient }
  36. procedure TTimeClient.Test;
  37. var
  38. i: integer;
  39. begin
  40. with TIdTime.Create(nil) do try
  41. Host := Trim(GlobalParamValue('NTP Server'));
  42. if Length(Host) = 0 then
  43. begin
  44. Host := GTimeHost;
  45. end;
  46. for i := 1 to 10 do begin
  47. Status(IntToStr(i) + ': ' + DateTimeToStr(DateTime));
  48. end;
  49. finally Free; end;
  50. end;
  51. initialization
  52. TIndyBox.RegisterBox(TTimeClient, 'Time Client', 'Clients');
  53. end.