Jump to content

Time from 1970 in miliseconds


oren
 Share

Recommended Posts

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

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

Link to comment
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.

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