Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to get NT server date and time.
Message
De
04/06/1999 09:47:33
 
 
À
04/06/1999 09:33:15
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00226416
Message ID:
00226484
Vues:
32
>>How do I get date and time of NT server to register in to log file, from application running from Win 95 node.
>>
>>TIA
>
>Here's a function I wrote, that doesn't require using the API... seems to work ok.
>
>
>#DEFINE _SERVER "svrgoliath"
>#DEFINE _PATH "storage"
>
>function ServerTime( cServerName, cPath )
>
>local cUNC,cTmpFile,tServerTime
>
>if empty( cServerName )
>	cServerName = _SERVER
>endif
>if empty( cPath )
>	cPath = _PATH
>endif
>
>cTmpFile = '!'+right(SYS(2015),7)+'.tmp'
>
>cUNC = addbs('\\'+cServerName)
>
>if left(cPath,1) = '\'
>	cPath = subs(cPath,2)
>endif
>
>cUNC = addbs(cUNC+cPath)+cTmpFile
>
>set alternate to ( cUNC )
>?
>set alternate to
>
>tServerTime = FDATE( cUNC, 1 )
>
>delete file ( cUNC )
>
>return tServerTime
>
>
>It actually returns a DateTime but you can pull the time out if you want. As you can see, the user will need write,read,delete access on the path you sepcify for this to work.
>

It's a neat approach to the problem, Bob; I see two possible problems:

(1) You need write access to somewhere on the NT box in question, and
(2) I've gotten some funny time stamp conversions reading a date/time stamp off an NTFS volume on some release of NT with some Win9x versions. The date/time stamp read off the NT box vaied by up to an hour with the date/time stamp read for the same file from a networked Win9x box. I've never pinpointed the problem, but it has resulted in a lot of head-scratching; biggest problems seem to have come up during development; I sometimes got .FXPs back from an NT box date/time stamped earlier than the .PRG file when the .FXP was compiled from the Win9x box and the .PRG modified on the NT box in the same shared NT directory.

>BOb
EMail: EdR@edrauh.com
"See, the sun is going down..."
"No, the horizon is moving up!"
- Firesign Theater


NT and Win2K FAQ .. cWashington WSH/ADSI/WMI site
MS WSH site ........... WSH FAQ Site
Wrox Press .............. Win32 Scripting Journal
eSolutions Services, LLC

The Surgeon General has determined that prolonged exposure to the Windows Script Host may be addictive to laboratory mice and codemonkeys
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform