IdUnixTimeServer.pas 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. {
  2. $Project$
  3. $Workfile$
  4. $Revision$
  5. $DateUTC$
  6. $Id$
  7. This file is part of the Indy (Internet Direct) project, and is offered
  8. under the dual-licensing agreement described on the Indy website.
  9. (http://www.indyproject.org/)
  10. Copyright:
  11. (c) 1993-2005, Chad Z. Hower and the Indy Pit Crew. All rights reserved.
  12. }
  13. {
  14. $Log$
  15. }
  16. {
  17. Rev 1.0 2/10/2005 2:26:36 PM JPMugaas
  18. New UnixTime Service (port 519) components.
  19. }
  20. unit IdUnixTimeServer;
  21. interface
  22. {$i IdCompilerDefines.inc}
  23. uses
  24. {$IFDEF WORKAROUND_INLINE_CONSTRUCTORS}
  25. Classes,
  26. {$ENDIF}
  27. IdAssignedNumbers,
  28. IdCustomTCPServer,
  29. IdGlobalProtocols,
  30. IdTimeServer;
  31. {
  32. This is based on a description at
  33. http://amo.net/AtomicTimeZone/help/ATZS_Protocols.htm#Unix
  34. UnixTime and UnixTime Protocol
  35. Unix is an operating system developed in 1969 by Ken Thompson. UnixTime
  36. counts "epochs" or seconds since the Year 1970. UnixTime recently hit it's
  37. billionth birthday.
  38. Because Unix is widely used in many environments, UnixTime was developed into
  39. a loose simple time protocol in the late 80's and early 90's. No formal
  40. UnixTime protocol has ever been officially published as an internet protocol -
  41. until now.
  42. UnixTime operates on the same UnixTime port - 519. Once a connection is
  43. requested on this port, exactly like in Time Protocol, the UnixTime value
  44. is sent back by either tcp/ip or udp/ip. When UDP/IP is used, a small packet
  45. of data must be received by the server in order to respond in the exact same
  46. fashion as Time Protocol. The UnixTime is then sent as an unsigned
  47. "unformatted" integer on the same port.
  48. }
  49. type
  50. TIdUnixTimeServer = class(TIdCustomTimeServer)
  51. protected
  52. procedure InitComponent; override;
  53. {$IFDEF WORKAROUND_INLINE_CONSTRUCTORS}
  54. public
  55. constructor Create(AOwner: TComponent); reintroduce; overload;
  56. {$ENDIF}
  57. published
  58. property DefaultPort default IdPORT_utime;
  59. end;
  60. implementation
  61. { TIdUnixTimeServer }
  62. {$IFDEF WORKAROUND_INLINE_CONSTRUCTORS}
  63. constructor TIdUnixTimeServer.Create(AOwner: TComponent);
  64. begin
  65. inherited Create(AOwner);
  66. end;
  67. {$ENDIF}
  68. procedure TIdUnixTimeServer.InitComponent;
  69. begin
  70. inherited;
  71. DefaultPort := IdPORT_utime;
  72. FBaseDate := UNIXSTARTDATE;
  73. end;
  74. end.