Jump to content

Get Date and time From Server instead machine Time


Recommended Posts

I think you should look at solving the problem rather than monitoring it. The way I would approach this problem is to periodically check the current time from a server on the internet. Some code like this:

#include <INet.au3>
$source = _INetGetSource("http://tycho.usno.navy.mil/cgi-bin/timer.pl")
MsgBox(0, "", $source)

Then write some code to extract the time zone closest to you. Add or subtract the hours needed to adjust for your time zone. Then you could use _Date_Time_SetSystemTime to set the time. You could use Window's Task Scheduler to run the script every day or every few hours.

Edited by sleepydvdr

#include <ByteMe.au3>

Link to comment
Share on other sites

I am sorry. I completely misunderstood what you were asking. This is what you need:

Yessssssssssss

Like some thing

but i want used simple to get date from server and match the script date and decide run or not using if condition ...

Is it possible if then how ????????????????????????????

Thankssssss

Link to comment
Share on other sites

I think that in order to do that, you would have to set up an NTP time server and somehow make it broadcast publicly.

Or you may be able to set up a website that always displays the current date/time and use similar code from my first post to check it. Kind of like the Naval website did it.

Think about this: what if they are using a laptop and cannot connect to the internet? What if your server is down? Does that mean that everyone who has your software will not be able to use it?

#include <ByteMe.au3>

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...