Internet Time...
Ned Konz
ned at bike-nomad.com
Thu Mar 28 21:36:40 UTC 2002
On Thursday 28 March 2002 01:03 pm, Bert Freudenberg wrote:
> > I just realised there is nothing to get 'Internet Time' in Squeak. If I
> > write the code, what will I have to do to submit it for updation in the
> > final image?
If it helps, this will do RFC868 (no error handling, etc.):
| s addr response time |
s _ Socket new.
addr _ NetNameResolver promptUserForHostAddress.
s connectTo: addr port: 37.
s waitForConnectionUntil: Socket standardDeadline.
response _ ByteArray withAll: s getData. "from Jan 1 1900"
time _ response unsignedLongAt: 1 bigEndian: true.
time _ time - (365 * 24 * 60 * 60). "shift to 1901"
(Time dateAndTimeFromSeconds: time) inspect
--
Ned Konz
currently: Stanwood, WA
email: ned at bike-nomad.com
homepage: http://bike-nomad.com
More information about the Squeak-dev
mailing list
|