Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to get NT server date and time.
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00226416
Message ID:
00299525
Vues:
31
I saw the earlier thread. None of them, though, had indicated that they were using it on an NT Server. Maybe that's the distinction.


>Hmm... I actually don't know... I tested this and my file gets the time/date stamp of the server, And I think several other people here are using this.
>
>I also have a guy using it on a Novel server that says it works. Perhaps someone else will have an idea.
>
>BTW: There is an API but it is only avialble on NT workstations as far as I know.
>
>>OK, change in facts. . .the file is being created on the server, but it is using the workstation date when it creates the file.. . .that's what's happening
>>
>>Now what??
>>
>>>>Put a SET STEP ON after the 'SET ALTERNATE TO' line. In the debugger what is the value of cUNC? Go to that path and see if that file is there? You need to have rights to the directory you are specifiying.
>>>>
>>>>BOb
>>>>
>>>>
>>>>>I must be doing something wrong but I ran the code you posted below and it keeps returning the date and time for my workstation, not the NT Server. Any Thoughts? Here is my exact code:
>>>>>
>>>>> #DEFINE _SERVER "CYSSERVER"
>>>>> #DEFINE _PATH "NETC"
>>>>>
>>>>>cServerName = _SERVER
>>>>>cPath = _PATH
>>>>>
>>>>>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 )
>>>>>? tServerTime
>>>>>delete file ( cUNC )
>>>>>
>>>>>---------------------------------------------------------------------------
>>>>>
>>>>>
>>>>>
>>>>>>>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.
>>>>>>
>>>>>>BOb
CySolutions, Medical Information Technology
You're only as good as your last
success, so . . .If it works. . .don't fix it!
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform