Sysdatetime()

Startbeitrag von Mark Vissers am 02.03.2016 11:58

Hello,

When i trie to use the SysDateTime() command, my system date andwon't change.
Windev 18.
I've got fulle adminstrator rights, but date won't change.

Below the command I'm using.

SysDateTime("20160202020202002")

Any idea.

Antworten:

Hi, your program really needs admin rights in order to actually change system date! If you start the program "as an administrator" it will change date / time indeed.

Yes, there's a conflict. We want to install / run the program with minimum rights because we seek to avoid the UAC window to show up and disturb user's operation. AND we want to detect whenever the system's time is wrong because we want to ensure correct multi-user operation and correct licensing. You can't serve both intents at at the same time.

My solution is

1 - to stop program operation if the internet is not connected at start-up time.
2 - to access a trusted server in order to retrieve correct date+time
3 - compare the system's date+time with the retrieved date+time.

If the retrieved date+time is far off (you decide what's "far off") the system's date+time, I let the program stop wth the message that they have to get their system's date+time in sync with the official date+time. I give the hint that they can ensure a correct sync just by opening the control panel click on date + time and choose the tab Internet time ... see http://windows.microsoft.com/en-us/windows/set-clock#1TC=windows-7

Now, your dear customer HAS to fix the date+time problem of his computer, otherwise there's no way to run the program.

Retrieving date + time from a trusted server (no need to access a time server using nntp protocol on the web)

IF InternetConnected = True THEN
IF HTTPRequest(NoSpace("http://derstandard.at";)) THEN
MyHeader = HTTPGetResult(httpHeader)


You just have to parse the string MyHeader. It contains the nearly correct date + time.

von GuenterP - am 02.03.2016 15:28
Zur Information:
MySnip.de hat keinen Einfluss auf die Inhalte der Beiträge. Bitte kontaktieren Sie den Administrator des Forums bei Problemen oder Löschforderungen über die Kontaktseite.
Falls die Kontaktaufnahme mit dem Administrator des Forums fehlschlägt, kontaktieren Sie uns bitte über die in unserem Impressum angegebenen Daten.