Sign in to follow this  
Followers 0
oren

Time from 1970 in miliseconds

5 posts in this topic

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.

Share this post


Link to post
Share on other sites



Use _DateDiff() to find this value in seconds and then is piece of cake.


When the words fail... music speaks

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

#4 ·  Posted (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 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

Share this post


Link to post
Share on other sites

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.

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
Sign in to follow this  
Followers 0