IdUnixTimeServer.pas 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  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. Classes,
  25. IdAssignedNumbers,
  26. IdCustomTCPServer,
  27. IdGlobalProtocols,
  28. IdTimeServer;
  29. {
  30. This is based on a description at
  31. http://amo.net/AtomicTimeZone/help/ATZS_Protocols.htm#Unix
  32. UnixTime and UnixTime Protocol
  33. Unix is an operating system developed in 1969 by Ken Thompson. UnixTime
  34. counts "epochs" or seconds since the Year 1970. UnixTime recently hit it's
  35. billionth birthday.
  36. Because Unix is widely used in many environments, UnixTime was developed into
  37. a loose simple time protocol in the late 80's and early 90's. No formal
  38. UnixTime protocol has ever been officially published as an internet protocol -
  39. until now.
  40. UnixTime operates on the same UnixTime port - 519. Once a connection is
  41. requested on this port, exactly like in Time Protocol, the UnixTime value
  42. is sent back by either tcp/ip or udp/ip. When UDP/IP is used, a small packet
  43. of data must be received by the server in order to respond in the exact same
  44. fashion as Time Protocol. The UnixTime is then sent as an unsigned
  45. "unformatted" integer on the same port.
  46. }
  47. type
  48. TIdUnixTimeServer = class(TIdCustomTimeServer)
  49. public
  50. constructor Create(AOwner: TComponent); override;
  51. published
  52. property DefaultPort default IdPORT_utime;
  53. end;
  54. implementation
  55. { TIdUnixTimeServer }
  56. constructor TIdUnixTimeServer.Create(AOwner: TComponent);
  57. begin
  58. inherited Create(AOwner);
  59. DefaultPort := IdPORT_utime;
  60. FBaseDate := UNIXSTARTDATE;
  61. end;
  62. end.