In some instances (e.g. auditing), it is important that the times of systems be in synch.
To this end, you can use the WinAPI to synchronize two NT machines using the following.
It is important to use the SetSystemtime and not SetLocalTime.
In Your main main program put this syntax:
Function SyncDateTimeFromServer(tcserver)
Local lcserver, llretval
llretval = .F.
If vartype(tcserver) = "C" ;
and !empty(tcserver) then
lcserver = upper(alltrim(tcserver))
Else
* no server to synchronize with; return .F.
Return llretval
Endif
Declare integer NetRemoteTOD in netapi32 STRING@, INTEGER@
Declare RtlMoveMemory IN WIN32API as CopyMemory STRING@, INTEGER, INTEGER
Declare integer SetSystemTime in kernel32 STRING@
* NetRemoteTOD requires a NULL terminated UNICODE string
* The server name should be in the format e.g: \\Agit72, or \\MSP-Works.com
Function NumtoWord
Lparameter tnNum
lcresult = chr(0)+chr(0)
If tnNum < (2^15 - 1) then
lcresult = chr(mod(tnNum,256))+chr(int(tnNum/256))
Else
* not a valid number for a WORD value
Endif
Return lcresult
Endfunc
* Agit Permana (08561052915)
* Mitra Solusi Pratama, PT
* http://www.msp-works.com
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.