简体   繁体   English

如何跟踪Java GUI应用程序上使用的时间?

[英]How to keep track of time used on Java GUI application?

我正在为我的课程创建Java GUI Web浏览器,我想知道是否有一种方法可以测量(以秒,分钟等整数形式)访问特定URL的时间。

Could you use System.currentTimeMillis() upon page load completion, then passing that to a utility method (comparing the value with another call to System.currentTimeMillis()) as soon as another URL is loaded/the page is closed? 您能否在页面加载完成时使用System.currentTimeMillis(),然后在加载另一个URL /关闭页面后将其传递给实用程序方法(将值与对System.currentTimeMillis()的另一个调用进行比较)?

That is not an integer time that you would get with System.currentTimeMillis(); 这不是使用System.currentTimeMillis()会得到的整数时间。 If you're dead set on an int number of seconds/minutes/etc, you can look into java.util.Date or Calendar 如果您以秒/分钟/等整数的形式设置为死值,则可以查看java.util.DateCalendar

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM