Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.soft-sys.math.mathematica > #4414
| From | Sébastien Roy <roys3d@gmail.com> |
|---|---|
| Newsgroups | comp.soft-sys.math.mathematica |
| Subject | Re: Getting the Date and Time From a Time Server |
| Date | 2011-08-15 00:24 +0000 |
| Organization | Steven M. Christensen and Associates, Inc and MathTensor, Inc. |
| Message-ID | <j29ov2$7ct$1@smc.vnet.net> (permalink) |
| References | <j25kro$ou6$1@smc.vnet.net> |
Maybe you could run the "ntpdate" program external and retreive the
time offset between your computer clock and the time server.
(in the following example, the time server is only good in canada)
Run["ntpdate -q time.chu.nrc.ca >/tmp/toto"]
res=Import["/tmp/toto", "Table","FieldSeparators" -> {" ", ","}]
offset=res[[1,6]] (* not very portable... :-( *)
Now you can use the internal Mathematica clock and add the offset to
get the correct time.
DateList[AbsoluteTime[]+offset]
Back to comp.soft-sys.math.mathematica | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Getting the Date and Time From a Time Server Gregory Lypny <gregory.lypny@videotron.ca> - 2011-08-13 10:49 +0000 Re: Getting the Date and Time From a Time Server Sébastien Roy <roys3d@gmail.com> - 2011-08-15 00:24 +0000 Re: Getting the Date and Time From a Time Server "McHale, Paul" <Paul.McHale@excelitas.com> - 2011-08-19 10:35 +0000
csiph-web