Page 1 of 1

System-wide Time() function

Posted: Wed Jun 30, 2010 9:56 am
by GeneB
Is there a way to use the time() function to reset the time on all stations to the server's time? Or is there a way to use the time() from the server rather than from the station running the exe file?

Re: System-wide Time() function

Posted: Wed Jun 30, 2010 10:38 am
by Wolfgang Ciriack
Perhaps you can set the time of the computer with

Code: Select all

net time /SET

Re: System-wide Time() function

Posted: Wed Jun 30, 2010 7:12 pm
by GeneB
Thanks. This certainly works. I was wondering if there was an Express command or a way in Xbase to build this into the *.exe file.

Re: System-wide Time() function

Posted: Wed Jun 30, 2010 9:30 pm
by skiman
GeneB wrote:I was wondering if there was an Express command or a way in Xbase to build this into the *.exe file.
If there is an Xbase function, it should propably be in the xbtools. I didn't check, but there are some network functions in it.

Re: System-wide Time() function

Posted: Sun Jul 04, 2010 4:59 pm
by Auge_Ohr
skiman wrote:If there is an Xbase function, it should propably be in the xbtools. I didn't check, but there are some network functions in it.
XbTools Network Function XbtNetW.LIB need Novel Client like NnetSTime() and does not work with M$ Lanmanager.
only some NetBIOS functions of XBTNETB.LIB can be used in M$ Network

Re: System-wide Time() function

Posted: Tue Jul 06, 2010 12:50 pm
by GeneB
I came up with a very simple way to do this: create a file on the server, extract its time and date, erase the file.
The file created has the server's time/date, and the station uses that to time stamp its document. It is far less likely that a user will accidentally change the server's time and date, as they occassionally do to the stations. This is very important in our retail situation for sales receipts, cash balancing, sales reports, etc.

-=#GeneB

Code: Select all

FUNCTION ServerTimeDate()
local  cTime,dDate, nHandle, aDirectory

// requires  Directry.ch
// DataPath() stores the path to the dbf files on the server
// file gets creation time and date from the server it resides on, DataPath()

FERASE( DataPath() + "\timefile.txt" )
nHandle := FCreate(DataPath() + "\timefile.txt")

// get the file's date and time
IF nHandle > 0
   aDirectory := DIRECTORY ( DataPath() + "\timefile.txt" )
   dDate := aDirectory[1,F_CREATION_DATE]
   cTime := aDirectory[1,F_CREATION_TIME]
ELSE
   dDate := DATE()
   cTime := TIME()
ENDIF

FCLOSE(nHandle)
FERASE( DataPath() + "\timefile.txt" )

RETURN {cTime,dDate}