Jump to content
svenjatzu

Controll windows time / date - set to internettime and sync it

Recommended Posts

Hi

 

im looking for a way to change the time from my windows system with scrypt.

sometimes the set time is incorrect so that severl programs wont run.

The sollution is resync the nettime by klick on sync time from internet.

 

someone knows how to reallise this?

Share this post


Link to post
Share on other sites

@svenjatzu
Take a look at 
_Date_Time_SetSystemTime :)


Click here to see my signature:

Spoiler

Thoughts:

  • I will always thank you for the time you spent for me.
    I'm here to ask, and from your response, I'd like to learn.
    By my knowledge, I can help someone else, and "that someone" could help in turn another, and so on.

/*--------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/

ALWAYS GOOD TO READ:

 

Share this post


Link to post
Share on other sites
Posted (edited)

@svenjatzu
If you take a look at the sample about the function mentioned below, it is explained how.

Edited by FrancescoDiMuro

Click here to see my signature:

Spoiler

Thoughts:

  • I will always thank you for the time you spent for me.
    I'm here to ask, and from your response, I'd like to learn.
    By my knowledge, I can help someone else, and "that someone" could help in turn another, and so on.

/*--------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/

ALWAYS GOOD TO READ:

 

Share this post


Link to post
Share on other sites

or how can i include the http://worldtimeapi.org/ api inside

    ; Set new system time
    $tNew = _Date_Time_EncodeSystemTime(8, 19, @YEAR, 3, 10, 45)
    If Not _Date_Time_SetSystemTime($tNew) Then
        MsgBox($MB_SYSTEMMODAL, "Error", "System clock cannot be SET" & @CRLF & @CRLF & _WinAPI_GetLastErrorMessage())
        Exit
    EndIf
    $tNew = _Date_Time_GetSystemTime()
    MemoWrite("New system date/time .....: " & _Date_Time_SystemTimeToDateTimeStr($tNew))

Share this post


Link to post
Share on other sites

I recall that longtime ago a similar question was asked, and several solutions was suggested

One of those solutions might work for you

 

Cheers
/Rex

Share this post


Link to post
Share on other sites
18 hours ago, svenjatzu said:

or how can i include the http://worldtimeapi.org/ api inside

Here is how you get the date and time out the web site :

#include <Constants.au3>
Local $String = BinaryToString(InetRead ("http://worldtimeapi.org/api/timezone/America/Toronto",1))
Local $Time = StringRegExp ($String,'datetime: (.+?)T(\d+:\d+:\d+)', $STR_REGEXPARRAYMATCH)
MsgBox ($MB_SYSTEMMODAL,"",$Time[0] & " " & $Time[1])

Now I will let you convert those to the right format.  Not a big deal...

Share this post


Link to post
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

×
×
  • Create New...