Humans like to measure time in variety of units including nanoseconds, microseconds, seconds, hours, days, weeks, months, years and centuries. For computation it is best to convert your times and time durations to a common unit, do your calculations, then convert back into whatever units the user likes. The most common units to work with are the millisecond used by System.currentTimeMillis, Date, Calendar and days used by BigDate. You can roll your own conversions or you can use java.util.concurrent.TimeUnit that came in with Java version 1.5. Here are the various conversion factors you will need, both created from scratch and via TimeUnit.
TimeUnit always rounds down when converting units.
TimeUnit is available in Java 1.5+. Prior to that you will have to roll your own conversion constants.
This page is posted |
http://mindprod.com/jgloss/timeunit.html | |
Optional Replicator mirror
|
J:\mindprod\jgloss\timeunit.html | |
Please read the feedback from other visitors,
or send your own feedback about the site. Contact Roedy. Please feel free to link to this page without explicit permission. | ||
Canadian
Mind
Products
IP:[65.110.21.43] Your face IP:[44.222.134.250] |
| |
Feedback |
You are visitor number | |