mark2004 Posted April 25, 2009 Share Posted April 25, 2009 I am trying to write a timeclock program for my business where employees click a button to clock in and out. If I use the time/date macros built into Autoit am I just pulling this from the system time?? If so, it seems that it would be pretty easy to just change the system time and then clock in/out and then change the system time back to normal and fool the system. My question is: Is there a way to get time values that are independent of the Windows system time (the time that is adjustable from the system tray)???? Thanks. Link to comment Share on other sites More sharing options...
Valuater Posted April 25, 2009 Share Posted April 25, 2009 http://www.autoitscript.com/forum/index.ph...ost&p=942268) Link to comment Share on other sites More sharing options...
mark2004 Posted April 25, 2009 Author Share Posted April 25, 2009 http://www.autoitscript.com/forum/index.ph...ost&p=942268)Thanks Valuater.I looked at that topic and I don't see your latest code. You claimed to have updated page 1 but your code is not on page 1. Is there a way to get your latest code??Thanks Link to comment Share on other sites More sharing options...
Valuater Posted April 25, 2009 Share Posted April 25, 2009 This might help.. MsgBox(4096, "Time", GetTime()) Func GetTime() $getlist = InetGet("http://tycho.usno.navy.mil/cgi-bin/timer.pl", "c:\time") If $getlist = 0 Then MsgBox(0, "Error", "Inet time not availible, check connection.") $infile = FileRead("C:\time", FileGetSize("C:\time")) $mytime = StringInStr($infile, "UTC") $thetime = StringMid($infile, $mytime - 9, 8) $hour = Number(StringLeft($thetime, 2)) $min = Number(StringMid($thetime, 4, 2)) $sec = Number(StringRight($thetime, 2)) Return $hour & ":" & $min & ":" & $sec EndFunc ;==>GetTime 8) Link to comment Share on other sites More sharing options...
mark2004 Posted April 25, 2009 Author Share Posted April 25, 2009 This might help.. MsgBox(4096, "Time", GetTime()) Func GetTime() $getlist = InetGet("http://tycho.usno.navy.mil/cgi-bin/timer.pl", "c:\time") If $getlist = 0 Then MsgBox(0, "Error", "Inet time not availible, check connection.") $infile = FileRead("C:\time", FileGetSize("C:\time")) $mytime = StringInStr($infile, "UTC") $thetime = StringMid($infile, $mytime - 9, 8) $hour = Number(StringLeft($thetime, 2)) $min = Number(StringMid($thetime, 4, 2)) $sec = Number(StringRight($thetime, 2)) Return $hour & ":" & $min & ":" & $sec EndFunc ;==>GetTime 8) Thanks. Also, is there a way to get access to any other stable time source without using the internet?? I currently have a PC in my shop that is off the network and I'd like to be able to use a PC timeclock until I can get internet out there. Link to comment Share on other sites More sharing options...
Spiff59 Posted April 26, 2009 Share Posted April 26, 2009 (edited) That's a cool website. Gives you the time without a ton of HTMl to wade through. I have a script that stamps transactions with the time, and will make use of that routine to correct the system clock. I did change it a bit to get rid of the disk access (and I want to keep the leading zeros): include<inet.au3> MsgBox(4096, "Time", GetTime()) Func GetTime() $infile = _InetGetSource("http://tycho.usno.navy.mil/cgi-bin/timer.pl") If $infile Then Return StringMid($infile, StringInStr($infile, "UTC") - 9, 8) MsgBox(0, "Error", "Inet time not availible, check connection.") EndFunc;==>GetTime Edit: Actually, I'll do the search on "Central - 17" so I wont have to do the "$hour -= 6; If $hour < 0 then $hour += 24" thing to convert GMT to my time zone Edited April 26, 2009 by Spiff59 Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now