MathGroup Archive 2011

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Getting the Date and Time From a Time Server

  • To: mathgroup at smc.vnet.net
  • Subject: [mg120911] Re: Getting the Date and Time From a Time Server
  • From: Gregory Lypny <gregory.lypny at videotron.ca>
  • Date: Sun, 14 Aug 2011 20:21:15 -0400 (EDT)
  • Delivered-to: l-mathgroup@mail-archive0.wolfram.com
  • References: <201108131047.GAA25453@smc.vnet.net>

Hi Hans,

Thank you for the script.  Unfortunately, I get the following Mathematica error message when I run it.


XML`Parser`XMLGetString::prserr: NetAccessorException: Could not open file: http://time.nist.gov:13/ at Line: 2 Character: 88.


Regards,

Gregory


On Sat, Aug 13, 2011, at 2:49 PM, Hans Michel wrote:

> Using Mathematica Version 7
> 
> $Version
> 
> "7.0 for Microsoft Windows (32-bit) (February 18, 2009)"
> 
> Import["http://time.nist.gov:13/";]
> With port numbers fails.
> 
> Try the following trick: 
> 
> In[1]:= getNISTTime[] := 
>  Module[{NISTTimeXML, result}, 
>   NISTTimeXML = 
>    ImportString[
>     "<?xml version='1.0' encoding='UTF-8'?><!DOCTYPE NISTTime \
> [<!ENTITY datetime SYSTEM
>          'http://time.nist.gov:13/'><!ELEMENT NISTTime \
> (#PCDATA)>]><NISTTime>&datetime;</NISTTime>", "XML"];
>   result = 
>    First[Cases[NISTTimeXML, XMLElement["NISTTime", {}, ___], 
>        Infinity]][[3]][[1]];
>   result];
> 
> 
> In[2]:= getNISTTime[]
> 
> Out[2]= "55786 11-08-13 18:24:53 50 0 0 441.7 UTC(NIST) *"




  • Prev by Date: Re: How to plot weighted edges on this graph?
  • Next by Date: Re: Map legend
  • Previous by thread: Re: Getting the Date and Time From a Time Server
  • Next by thread: Re: Getting the Date and Time From a Time Server