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