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