oren Posted September 19, 2009 Share Posted September 19, 2009 I need to function that will give me currentTimeMillis() <- java which is "the difference, measured in milliseconds, between the current time and midnight, January 1, 1970 UTC." How can i calculate the different from January 1, 1970 UTC to this moment but in millisecond.. not seconds.. Thank you. Link to comment Share on other sites More sharing options...
Andreik Posted September 19, 2009 Share Posted September 19, 2009 Use _DateDiff() to find this value in seconds and then is piece of cake. When the words fail... music speaks. Link to comment Share on other sites More sharing options...
oren Posted September 19, 2009 Author Share Posted September 19, 2009 Use _DateDiff() to find this value in seconds and then is piece of cake.Thank you but i need milliseconds not seconds. And multiplying the solution in 1000 is not a option. Link to comment Share on other sites More sharing options...
Bowmore Posted September 19, 2009 Share Posted September 19, 2009 (edited) Thank you but i need milliseconds not seconds. And multiplying the solution in 1000 is not a option. Why do you need to know such a long time period to millisecond precision? This will give you the difference in milliseconds. Note: depending on the chip set in your PC you may not be able to resolve the time to less than 15 or 16 milliseconds. #Include <Date.au3> $Millseconds = (_DateDiff("s","1970/01/01 00:00:00",@YEAR & "/" & @MON & "/" & @MDAY & " " & @HOUR & ":" & @MIN & ":" & @SEC) * 1000) + @MSEC ConsoleWrite('$Millseconds = ' & $Millseconds & @crlf & '>Error code: ' & @error & @crlf) ;### Debug Console Edited September 19, 2009 by Bowmore "Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the universe trying to build bigger and better idiots. So far, the universe is winning."- Rick Cook Link to comment Share on other sites More sharing options...
oren Posted September 19, 2009 Author Share Posted September 19, 2009 Why do you need to know such a long time period to millisecond precision? This will give you the difference in milliseconds. Note: depending on the chip set in your PC you may not be able to resolve the time to less than 15 or 16 milliseconds. #Include <Date.au3> $Millseconds = (_DateDiff("s","1970/01/01 00:00:00",@YEAR & "/" & @MON & "/" & @MDAY & " " & @HOUR & ":" & @MIN & ":" & @SEC) * 1000) + @MSEC ConsoleWrite('$Millseconds = ' & $Millseconds & @crlf & '>Error code: ' & @error & @crlf) ;### Debug Console Thank you it work I needed to to send a server data. He need me to wait 60 sec and then to send my system time in milliseconds. 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