Jump to content

Detect time from server


sumkid
 Share

Recommended Posts

  • 1 month later...

Bump.

I would like to know this also, for a different reason.

Can someone point me in the right direction.

Thanks in advance.

taurus905

"Never mistake kindness for weakness."-- Author Unknown --"The highest point to which a weak but experienced mind can rise is detecting the weakness of better men."-- Georg Lichtenberg --Simple Obfuscator (Beta not needed.), Random names for Vars and Funcs

Link to comment
Share on other sites

  • Moderators

Bump.

I would like to know this also, for a different reason.

Can someone point me in the right direction.

Thanks in advance.

taurus905

I would imagine that being server specific... do you have more details that you could provide that would help with what you're asking?

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

I would imagine that being server specific... do you have more details that you could provide that would help with what you're asking?

SmOke_N,

I want to be able to run an .exe on my computer and get the time from the server where my website is hosted.

I appreciate you taking the time to think about this.

taurus905

"Never mistake kindness for weakness."-- Author Unknown --"The highest point to which a weak but experienced mind can rise is detecting the weakness of better men."-- Georg Lichtenberg --Simple Obfuscator (Beta not needed.), Random names for Vars and Funcs

Link to comment
Share on other sites

Isn't there a way to write a script that gets the time from somewhere on the internet so it can be assigned to a variable? This task seems like it should be easy to do.

Thanks for any ideas.

taurus905

"Never mistake kindness for weakness."-- Author Unknown --"The highest point to which a weak but experienced mind can rise is detecting the weakness of better men."-- Georg Lichtenberg --Simple Obfuscator (Beta not needed.), Random names for Vars and Funcs

Link to comment
Share on other sites

Throw a .php file on your server that echoes out the servers current time, then have an AutoIT script InetGetSource() that file.. it will be returned the file.

As for WoW, thats a tricky one, I seriously doubt that you could write a program capable of polling the server directly for its time.

Link to comment
Share on other sites

Throw a .php file on your server that echoes out the servers current time, then have an AutoIT script InetGetSource() that file.. it will be returned the file.

As for WoW, thats a tricky one, I seriously doubt that you could write a program capable of polling the server directly for its time.

tAKTelapis,

Thank you for the suggestion. From my research, I was leaning in that direction. Just to be clear, I am not doing anything with WoW. I am just trying to get my .exe to get the time from my server that hosts my website.

taurus905

"Never mistake kindness for weakness."-- Author Unknown --"The highest point to which a weak but experienced mind can rise is detecting the weakness of better men."-- Georg Lichtenberg --Simple Obfuscator (Beta not needed.), Random names for Vars and Funcs

Link to comment
Share on other sites

  • Moderators

tAKTelapis,

Thank you for the suggestion. From my research, I was leaning in that direction. Just to be clear, I am not doing anything with WoW. I am just trying to get my .exe to get the time from my server that hosts my website.

taurus905

I know why your doing it ... nanny nanny boo boo ... lol...

Try this:

#include <inet.au3>
#include <array.au3>;Only for Array display
#cs
[0] = Day of Week
[1] = Month (string)
[2] = Day of Month
[3] = Year
[4] = Hour
[5] = Minute
[6] = Second
[7] = AM/PM
#ce

Global $aArray = _ThereCanBeOnlyOneTimeLord()
_ArrayDisplay($aArray, "Returned Time Info")

Func _ThereCanBeOnlyOneTimeLord($nZone = 179);179 New York time
    Local $aSRE = StringRegExp( _
        _INetGetSource("http://www.timeanddate.com/worldclock/city.html?n=" & $nZone), _
        'Current time\<\/th\>\<td\>\<strong id="ct"\>(.*?)\<', 3)
    If IsArray($aSRE) = 0 Then Return SetError(1, 0, 0)
    Local $aINF = StringRegExp($aSRE[0], "(?i)(\w+), (\w+) (\d+), (\d+).*? (\d+):(\d+):(\d+) (\w+)",3)
    If IsArray($aINF) = 0 Then Return SetError(2, 0, 0)
    If UBound($aINF) <> 8 Then Return SetError(3, 0, 0)
    Return $aINF
EndFunc

Edit2:

Damn, when I replaced the code tags, I forgot to put back all the info.

Edited by SmOke_N

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

I know why your doing it ... nanny nanny boo boo ... lol...

Try this:

#include <inet.au3>
#include <array.au3>;Only for Array display
#cs
[0] = Day of Week
[1] = Month (string)
[2] = Day of Month
[3] = Year
[4] = Hour
[5] = Minute
[6] = Second
[7] = AM/PM
#ce

Global $aArray = _ThereCanBeOnlyOneTimeLord()
_ArrayDisplay($aArray, "Returned Time Info")

Func _ThereCanBeOnlyOneTimeLord($nZone = 179);179 New York time
    Local $aSRE = StringRegExp( _
        _INetGetSource("http://www.timeanddate.com/worldclock/city.html?n=" & $nZone), _
        'Current time\<\/th\>\<td\>\<strong id="ct"\>(.*?)\<', 3)
    If IsArray($aSRE) = 0 Then Return SetError(1, 0, 0)
    Local $aINF = StringRegExp($aSRE[0], "(?i)(\w+), (\w+) (\d+), (\d+).*? (\d+):(\d+):(\d+) (\w+)",3)
    If IsArray($aINF) = 0 Then Return SetError(2, 0, 0)
    If UBound($aINF) <> 8 Then Return SetError(3, 0, 0)
    Return $aINF
EndFunc

Edit2:

Damn, when I replaced the code tags, I forgot to put back all the info.

SmOke_N,

As always, "You're the man!" :-)

I knew you had the solution and I appreciate you sharing.

And I have no doubt that you know why I am doing this because I am sure you have done something similar in the past.

Thanks for taking the time.

taurus905

"Never mistake kindness for weakness."-- Author Unknown --"The highest point to which a weak but experienced mind can rise is detecting the weakness of better men."-- Georg Lichtenberg --Simple Obfuscator (Beta not needed.), Random names for Vars and Funcs

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...