Navigation:  The Buzz > Operating System  >

Fetch Server Time

Previous pageReturn to chapter overviewNext page

Nov 29, 2007  Button

I need a command to get server date on magic 7/9.

 

any suggestion?

 

Thanks

Heri Herwanto

 

In V9 yo can use the GetEnv() functions get values from the OS.

 

In v7 I think you will have to use get.dll. it should have a function

to get the server time.

 

Roger B. Ross

 

Maybe there is an easier way, but this one will work.

 

you call a batch with the following command:

"net time \\SERVERNAME /Y >Tempfile.txt"

 

you end up having in the Tempfile.txt a line like this:

"Current time at \\SERVERNAME is 11/30/2007 10:58 AM"

which you can import and parse in Magic very easy

 

HTH

Zvi

 

Another trick we have used is to create an empty text file on the server and

read the date/time stamp of the file with a get.dll function, then erase the

file. We discovered that a file created on the server by a client has the

date/time stamp of the server, not the client. At least this holds for

Windows networks, don't know about Netware, Unix, etc.

 

Thank You,

Rick Lieb

 

Heri,

 

As Zvi said, you can use for Windows networks the command line "NET TIME".

Point it to a server and then redirect the output to a file. Read the

contents of the file and you'll have the server's date/time.

 

If you don't mind resetting the current computer's date/time to that of the

server, you can use NET TIME to set the current computer's date/time (using

the /SET parm). We've done this just before time critical events to sync the

current computer's time to the server. Then the Magic Date() & Time()

functions are basically returning the server's date/time.

 

HTH

 

Keith

 

 

 

 


Page url: http://www.magic-iug.com/MIUGWeb3/index.html?hm_fetch_server_time.htm