This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Servlets and the fly likes Getting my desktop's time ? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Getting my desktop Watch "Getting my desktop New topic
Author

Getting my desktop's time ?

Tom Barns
Ranch Hand

Joined: Oct 27, 2000
Posts: 138
Hi all
I'm trying to get the time from my machine(desktop) from my jsp page.because i think when i use System.currentTimeMillis()
I get the time of my server(Tomcat).
I need to get the time from my machine and not the time of my server.I'm using that to test time performance.
or if System.currentTimeMillis() gets the time of my desktop,how do i get the time of my server.
thanks for help.


Thanks for your help.
Michael Hildner
Ranch Hand

Joined: Oct 13, 2000
Posts: 297
I'm no expert, but I'll give it a try. Someone please correct if I'm wrong.
I don't think it is possible to get the client's time from a server application. There no code running on the client. If I had to do this, I would probably use the JavaScript Date object. That would execute on the client side, then you could retrieve the value.
Tom Barns
Ranch Hand

Joined: Oct 27, 2000
Posts: 138
Thanks for your reply.
How about we get the client time using javascript and passing it
to the server application.
because what i need to do is to count the processing time of the server from the point that is you send the request to the point that is you get the response.
please advice.
thanks.
sandy gupta
Ranch Hand

Joined: Jan 30, 2001
Posts: 228
How do u know that the client machine is synchronized to the server time. It might be having a wrong time or might be in a diff time zone all together( if its a web app ).


Adios
Michael Hildner
Ranch Hand

Joined: Oct 13, 2000
Posts: 297
Sandy is right, you could try synchronizing them (comparing the two times), but even then you have to worry about network (dial-up?) speed.
Tom Barns
Ranch Hand

Joined: Oct 27, 2000
Posts: 138
Thansk for your time.
I'm testing that response on my machine that has tomcat on it.
that means we have 100% synchronization.
in will try to think how i will do that with other server.
maybe i will get back to ask.
Thanks again.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Getting my desktop's time ?
 
Similar Threads
getting System time
Timestamp Time Difference
Tomcat 6.0 installation help
Which linux?
NX: lockCookie generation