diff --git a/projects/samskivert/src/java/com/samskivert/util/RunAnywhere.java b/projects/samskivert/src/java/com/samskivert/util/RunAnywhere.java index 52726669..5423d6d1 100644 --- a/projects/samskivert/src/java/com/samskivert/util/RunAnywhere.java +++ b/projects/samskivert/src/java/com/samskivert/util/RunAnywhere.java @@ -1,8 +1,10 @@ // -// $Id: RunAnywhere.java,v 1.1 2003/05/02 23:47:39 mdb Exp $ +// $Id: RunAnywhere.java,v 1.2 2003/05/03 00:06:23 mdb Exp $ package com.samskivert.util; +import java.awt.event.InputEvent; + /** * Write once, run anywhere. Well, at least that's what it * said in the brochures. For those less than fresh days, you might need @@ -28,6 +30,17 @@ public class RunAnywhere return _isMacOS; } + /** + * Returns the timestamp associated with the supplied event except on + * the Macintosh where it returns {@link System#currentTimeMillis} + * because {@link InputEvent#getWhen} returns completely incorrect + * values. Hopefully this method will become unnecessary soon. + */ + public static long getWhen (InputEvent event) + { + return isMacOS() ? System.currentTimeMillis() : event.getWhen(); + } + /** Flag indicating that we're on Windows; initialized when this class * is first loaded. */ protected static boolean _isWindows;