Added detection of OS version to RunAnywhere

git-svn-id: https://samskivert.googlecode.com/svn/trunk@1661 6335cc39-0255-0410-8fd6-9bcaacd3b74c
This commit is contained in:
elizabeth
2005-06-23 21:39:21 +00:00
parent c6d25758e3
commit 017caac70b
2 changed files with 21 additions and 0 deletions
@@ -79,6 +79,14 @@ public class KeyUtil
return (rem == 0 ? prekey : key + (10 - rem));
}
public static void main (String[] args) {
String base = "888888888888888888";
for (int ii = 0; ii < 10; ii++) {
System.out.println(makeLuhnVerifiable(base + ii));
}
}
/**
* Return the luhn remainder for the given key.
*
@@ -40,6 +40,14 @@ public class RunAnywhere
{
return _isLinux;
}
/**
* Returns the string value of the OS version reported by the JVM
*/
public static final String getOSVersion ()
{
return _osversion;
}
/**
* Returns {@link System#currentTimeMillis}, but works around a bug on
@@ -91,6 +99,9 @@ public class RunAnywhere
/** Flag indicating that we're on Linux; initialized when this class
* is first loaded. */
protected static boolean _isLinux;
/** The version number that our OS reports */
protected static String _osversion;
/** Used to ensure that the timer is sane. */
protected static long _lastStamp, _lastWarning;
@@ -103,6 +114,8 @@ public class RunAnywhere
_isMacOS = (osname.indexOf("Mac OS") != -1 ||
osname.indexOf("MacOS") != -1);
_isLinux = (osname.indexOf("Linux") != -1);
_osversion = System.getProperty("os.version");
} catch (Exception e) {
// dang, can't grab system properties; we'll just pretend
// we're not on any of these OSes