System-wide Time() function

This forum is for general support of Xbase++
Post Reply
Message
Author
User avatar
GeneB
Posts: 158
Joined: Sun Jan 31, 2010 8:32 am
Location: Albuquerque, New Mexico, USA
Contact:

System-wide Time() function

#1 Post 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?

Wolfgang Ciriack
Posts: 479
Joined: Wed Jan 27, 2010 10:25 pm
Location: Berlin Germany

Re: System-wide Time() function

#2 Post by Wolfgang Ciriack »

Perhaps you can set the time of the computer with

Code: Select all

net time /SET
_______________________
Best Regards
Wolfgang

User avatar
GeneB
Posts: 158
Joined: Sun Jan 31, 2010 8:32 am
Location: Albuquerque, New Mexico, USA
Contact:

Re: System-wide Time() function

#3 Post 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.

skiman
Posts: 1185
Joined: Thu Jan 28, 2010 1:22 am
Location: Sijsele, Belgium
Contact:

Re: System-wide Time() function

#4 Post 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.
Best regards,

Chris.
www.aboservice.be

User avatar
Auge_Ohr
Posts: 1407
Joined: Wed Feb 24, 2010 3:44 pm

Re: System-wide Time() function

#5 Post 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
greetings by OHR
Jimmy

User avatar
GeneB
Posts: 158
Joined: Sun Jan 31, 2010 8:32 am
Location: Albuquerque, New Mexico, USA
Contact:

Re: System-wide Time() function

#6 Post 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}

Post Reply