Is it safe to compare JavaScript's getTime() across different systems?

JavaScript's getTime() returns "the number of milliseconds since 1 January 1970 00:00:00 UTC".

Can I rely on this being similar across different machines? I don't need it to be accurate to the millisecond, just to a few seconds.

Or do I need to use an external time service API, as in this question?

Where does JavaScript get the current time from - is it dependent on the machine's clock?

Answers


Can I rely on this being similar across different machines?

No.

Where does JavaScript get the current time from

The system datetime on which this javascript runs.

Or do I need to use an external time service API, as in this question?

You could use the server's time and send it to the client.


Need Your Help

How can I write asyncio coroutines that optionally act as regular functions?

python python-3.x python-asyncio

I'm writing a library that I'd like end-users to be able to optionally use as if its methods and functions were not coroutines.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.