'****************************************************************** ' javatime.vbs demonstrates using Java moniker to obtain ' system time measurement capability from Microsoft JVM class: ' com.ms.wfc.app.Time ' using method: toDouble() ' ' If the client machine has IE 5+ installed than the wfc classes ' are automatically available and no user configuration is required. ' ' Note that this same class provides a method toLong() which: ' "Returns a long value that represents the number of time ' units (100 nanoseconds) that have passed in this Time ' object since January 1, 100 AD." ' However, the method toLong() uses 8 byte Java long, which throws ' an overflow error via Java moniker in vbs. ' ' M. Gallant 06/20/2002 ' ******************************************************************** Option Explicit Const secsperday = 86400 Dim oJTime Dim timenow, timeold, timenew, i set oJTime = GetObject("java:com.ms.wfc.app.Time") timenow = oJTime.toDouble() WScript.Echo "The current time as an OLE-formatted double value " & _ vbCrLf & "using com.ms.wfc.app.Time.toDouble() method: " & _ vbCrLf & timenow & " days" & vbCrLf & vbCrLf '--- Demonstrate a simple timing loop to evaluate accuracy --- For i = 1 To 10 timeold = GetObject("java:com.ms.wfc.app.Time").toDouble() WScript.Sleep i*100 ' some code to time timenew = GetObject("java:com.ms.wfc.app.Time").toDouble() WScript.Echo "Interval: " & (timenew - timeold)*secsperday & " secs" Next '------ end javatime.vbs --------------------