IdDayTimeServer.pas 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  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: 10123: IdDayTimeServer.pas
  11. {
  12. { Rev 1.0 2002.11.12 10:35:06 PM czhower
  13. }
  14. unit IdDayTimeServer;
  15. interface
  16. {
  17. 2000-Apr-22: J Peter Mugass
  18. -Ported to Indy
  19. 1999-Apr-13
  20. -Final Version
  21. 2000-JAN-13 MTL
  22. -Moved to new Palette Scheme (Winshoes Servers)
  23. Original Author: Ozz Nixon
  24. }
  25. uses
  26. Classes,
  27. IdAssignedNumbers,
  28. IdTCPServer;
  29. Type
  30. TIdDayTimeServer = class(TIdTCPServer)
  31. protected
  32. FTimeZone: String;
  33. //
  34. function DoExecute(AThread: TIdPeerThread): boolean; override;
  35. public
  36. constructor Create(AOwner: TComponent); override;
  37. published
  38. property TimeZone: String read FTimeZone write FTimeZone;
  39. property DefaultPort default IdPORT_DAYTIME;
  40. end;
  41. implementation
  42. uses
  43. SysUtils;
  44. constructor TIdDayTimeServer.Create(AOwner: TComponent);
  45. begin
  46. inherited;
  47. DefaultPort := IdPORT_DAYTIME;
  48. FTimeZone := 'EST'; {Do not Localize}
  49. end;
  50. function TIdDayTimeServer.DoExecute(AThread: TIdPeerThread ): boolean;
  51. begin
  52. result := true;
  53. with AThread.Connection do begin
  54. Writeln(FormatDateTime('dddd, mmmm dd, yyyy hh:nn:ss', Now) + '-' + FTimeZone); {Do not Localize}
  55. Disconnect;
  56. end;
  57. end;
  58. end.