SQL Server
SQL Server
Measure Elapsed Time with the Convenience Timer
See more Socket/SSL/TLS Examples
Demonstrates Socket.StartTiming, which starts or restarts the object's convenience timer. The ElapsedSeconds property then reports the whole number of seconds since the call.
Background. This timer is a convenience for measuring durations and does not affect connection behavior or timeouts.
Chilkat SQL Server Downloads
--
CREATE PROCEDURE ChilkatSample
AS
BEGIN
DECLARE @hr int
DECLARE @iTmp0 int
DECLARE @socket int
EXEC @hr = sp_OACreate 'Chilkat.Socket', @socket OUT
IF @hr <> 0
BEGIN
PRINT 'Failed to create ActiveX component'
RETURN
END
-- Start (or restart) the object's convenience timer.
EXEC sp_OAMethod @socket, 'StartTiming', NULL
-- Perform some work. (Here the thread simply sleeps to let time pass.)
EXEC sp_OAMethod @socket, 'SleepMs', NULL, 1500
-- Read the whole number of seconds elapsed since StartTiming was called.
EXEC sp_OAGetProperty @socket, 'ElapsedSeconds', @iTmp0 OUT
PRINT 'Elapsed seconds: ' + @iTmp0
EXEC @hr = sp_OADestroy @socket
END
GO