{"action":"created","issue":{"url":"https://api.github.com/repos/HaxeFoundation/haxe/issues/4834","repository_url":"https://api.github.com/repos/HaxeFoundation/haxe","labels_url":"https://api.github.com/repos/HaxeFoundation/haxe/issues/4834/labels{/name}","comments_url":"https://api.github.com/repos/HaxeFoundation/haxe/issues/4834/comments","events_url":"https://api.github.com/repos/HaxeFoundation/haxe/issues/4834/events","html_url":"https://github.com/HaxeFoundation/haxe/issues/4834","id":131725529,"number":4834,"title":"Date.getTime documentation should be improved","user":{"login":"jcward","id":2192439,"avatar_url":"https://avatars.githubusercontent.com/u/2192439?v=3","gravatar_id":"","url":"https://api.github.com/users/jcward","html_url":"https://github.com/jcward","followers_url":"https://api.github.com/users/jcward/followers","following_url":"https://api.github.com/users/jcward/following{/other_user}","gists_url":"https://api.github.com/users/jcward/gists{/gist_id}","starred_url":"https://api.github.com/users/jcward/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jcward/subscriptions","organizations_url":"https://api.github.com/users/jcward/orgs","repos_url":"https://api.github.com/users/jcward/repos","events_url":"https://api.github.com/users/jcward/events{/privacy}","received_events_url":"https://api.github.com/users/jcward/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2016-02-05T18:58:04Z","updated_at":"2016-02-06T09:11:26Z","closed_at":null,"body":"The [Date.getTime()](https://github.com/HaxeFoundation/haxe/blob/development/std/Date.hx#L53-L56) [documentation](http://api.haxe.org/Date.html#getTime) states:\r\n\r\n> Returns the timestamp of the date. It might only have a per-second precision depending on the platforms.\r\n\r\nThe word *might* is not ideal in technical documents, and could turn off potential Haxe users perusing the docs. And handling time is a pretty common task.\r\n\r\nI think the docs could be improved by stating exactly which platforms have which resolution. Running a quick test on Linux, I see:\r\n\r\nSecond resolution: cpp, neko\r\nMillisecond resolution: php, python, java, flash, js\r\n(I couldn't test C#)\r\n\r\nIs it actually platform dependent (cpp on linux vs win vs iOS), or merely target language dependent?\r\n\r\nPerhaps note Sys.time() for getting the current timestamp on cpp, cs, java, macro, neko, php, python\r\n\r\nThus, I might suggest something like:\r\n\r\n> Returns the timestamp of `this` Date in milliseconds. Note that the cpp and neko targets only support integer second resolution (e.g. 1454698271000.) To obtain the current timestamp with millisecond precision on the cpp, cs, java, macro, neko, php, and python targets, see the `Sys.time` API."},"comment":{"url":"https://api.github.com/repos/HaxeFoundation/haxe/issues/comments/180722887","html_url":"https://github.com/HaxeFoundation/haxe/issues/4834#issuecomment-180722887","issue_url":"https://api.github.com/repos/HaxeFoundation/haxe/issues/4834","id":180722887,"user":{"login":"ncannasse","id":1022912,"avatar_url":"https://avatars.githubusercontent.com/u/1022912?v=3","gravatar_id":"","url":"https://api.github.com/users/ncannasse","html_url":"https://github.com/ncannasse","followers_url":"https://api.github.com/users/ncannasse/followers","following_url":"https://api.github.com/users/ncannasse/following{/other_user}","gists_url":"https://api.github.com/users/ncannasse/gists{/gist_id}","starred_url":"https://api.github.com/users/ncannasse/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ncannasse/subscriptions","organizations_url":"https://api.github.com/users/ncannasse/orgs","repos_url":"https://api.github.com/users/ncannasse/repos","events_url":"https://api.github.com/users/ncannasse/events{/privacy}","received_events_url":"https://api.github.com/users/ncannasse/received_events","type":"User","site_admin":false},"created_at":"2016-02-06T09:11:26Z","updated_at":"2016-02-06T09:11:26Z","body":"On Neko I am using the libc api for date, which uses an Int32 for storage and a struct tm for manipulation. http://en.cppreference.com/w/c/chrono/tm I'm not sure if there's a better way to handle them. \r\n\r\nI would not rely on such API anyway to perform benchmarking, you usually need some even more precise API (micro seconds) and if possible measured for the current process, not a full system time.  \r\n\r\nFor instance on windows you might use QueryPerformanceCounter https://msdn.microsoft.com/en-us/library/windows/desktop/ms644904(v=vs.85).aspx\r\n"}}