Last week, we had the author of TDD for a Shopping Website LiveProject. Friday at 11am Ranch time, Steven Solomon will be hosting a live TDD session just for us. See for the agenda and registration link
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
• Campbell Ritchie
• Paul Clapham
• Ron McLeod
• Jeanne Boyarsky
• Tim Cooke
Sheriffs:
• Liutauras Vilda
• paul wheaton
• Henry Wong
Saloon Keepers:
• Tim Moores
• Tim Holloway
• Stephan van Hulst
• Carey Brown
• Frits Walraven
Bartenders:
• Piet Souris
• Himai Minh

# Thread.sleep(3600000) is = minute ?

Greenhorn
Posts: 4
• Number of slices to send:
Optional 'thank-you' note:
Hi
i am new baby for java
what is Thread.sleep(3600000) = minute ?
any math formula can tell?
Thank for helping

Sheriff
Posts: 13411
• Number of slices to send:
Optional 'thank-you' note:
"smart smart",
Welcome to the ranch!
-Ben

Bartender
Posts: 1638
• Number of slices to send:
Optional 'thank-you' note:
The argument to the sleep method, you have shown is in milliseconds.
1000 milliseconds = 1 seconds
60 seconds = 1 minute

I think you get the formula now

Ranch Hand
Posts: 59
• Number of slices to send:
Optional 'thank-you' note:
There's an easier way, just use the TimeUnit enumeration from java.util.concurrent.

To make a thread sleep for 1 minute, you do something like this:

TimeUnit.MINUTES.sleep(1);

To make it sleep for 30 seconds:

TimeUnit.SECONDS.sleep(30);

And so on.

author and iconoclast
Posts: 24204
44
• Number of slices to send:
Optional 'thank-you' note:

Originally posted by Ray Hsieh:
There's an easier way, just use the TimeUnit enumeration from java.util.concurrent.

Yes, that's an excellent solution, but note that there's no MINUTE member. There's SECOND, MICROSECOND, NANOSECOND, and such, but no MINUTE.

Ray Hsieh
Ranch Hand
Posts: 59
• Number of slices to send:
Optional 'thank-you' note:
Actually, there is, if we're talking about Java 6.

http://java.sun.com/javase/6/docs/api/java/util/concurrent/TimeUnit.html

It even has DAYS!

Ernest Friedman-Hill
author and iconoclast
Posts: 24204
44
• Number of slices to send:
Optional 'thank-you' note:
I stand corrected. Us old-timers, what do we know...

author
Posts: 23919
142
• Number of slices to send:
Optional 'thank-you' note:
I guess I am an old-timer too... but isn't 3600000 = one hour?

Henry

Greenhorn
Posts: 1
• Number of slices to send:
Optional 'thank-you' note:
I think this is you want to know.
1 s = 1000 ms
1 m = 60 s
1 h = 60 m

 Fire me boy! Cool, soothing, shameless self promotion: free, earth-friendly heat - a kickstarter for putting coin in your pocket while saving the earth https://coderanch.com/t/751654/free-earth-friendly-heat-kickstarter