>Hi there,
>
> I have a client who's business is highly dependant on time. He is worried about the fact that anyone can change the time on a pc through windows or dos if they know how.
>
> Is there a way of preventing the system clock to be changed by unauthorised users?
>
> If not, is there a way that computers can syncronize their time with a "time-server" every few seconds?
>
>Thanks,
>
>Mark
Mark,
I had a similar question last week. Bob Archer replied with the following:
Here is a program I wrote for this occasion:
#DEFINE _SERVER "svrsbdell1"
#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
THis actually returns a DateTime... also, the user must have full access to the path you specify for it to work... It uses an 8.3 file name so it
will [should] work fine on a Novel Server.
Bob
I took his example and simplified it for my needs and came up with:
*
* Program: SYSTIME
* Purpose: To get the current system time from the machine
* where this program is being run from
* Author : Mark J. Johns
* Date : October 13, 1999
*
private cTmpFile, lf, ld, lt
* create a temporary file in the directory where the program is running
cTmpFile = sys(5)+sys(2003)+'\!'+right(sys(2015),7)+'.tmp'
lf = fcreate(cTmpFile)
* close the file
=fclose(lf)
* get the date and time from the file
ld = fdate(cTmpFile)
lt = ftime(cTmpFile)
* erase the temporary file
erase &cTmpFile
* for testing purposes
*=messagebox('The system time is '+dtoc(ld)+' '+lt,64,'')
* return the date and time from the system
return ctot(dtoc(ld)+' '+lt)
This works in both VFP 5 and 6. (VFP 5 does not support the second parameter in fdate())
This function can be used in place of datetime() to retrieve the time from the server instead of the workstation.
I hope this helps.
Mark Johns