Posted by: Airtower | 2010-08-20

Good documentation can be funny

java.lang.System.nanoTime() is used to measure time spans as precisely as possible (if you actually get nanosecond precision depends on the platform). I just found a funny warning in the documentation:

Differences in successive calls that span greater than approximately 292 years (263 nanoseconds) will not accurately compute elapsed time due to numerical overflow.

I didn’t really think about running my Java programs for such a long time, but thanks!

The Android API documentation omits this warning. I don’t think that’s a real problem, but I found it to be imprecise in other cases, too. For example, the hint that the prefix string for java.io.File.createTempFile(String prefix, String suffix) must be at least three characters long is missing. That was easy enough to fix, but it would save some time to know stuff like this without running into an exception. Android has some funny methods of its own, though.

Advertisements

Leave a Comment

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Categories

%d bloggers like this: