SECONDS()
returns a numeric value of the number of seconds since midnight, with a resolution of one millisecond. SYS(2) returns a character string of the same number, formatted as five digits with no decimal places.
nRetVal = SECONDS()
cTime = SYS(2)
Very useful for benchmarking the time to complete a task—record the start time, do the task, then subtract the start time from the end time to calculate the duration of the task. Don't confuse this with the SEC()
function used to extract the seconds portion of a datetime.
SYS(2) does reflect changes made to the system time while Visual FoxPro is running, although we don't advise doing this—it can make it awfully difficult to determine which source code is the most recent when the time keeps shifting! SYS(2), like SECONDS()
, will reset on the stroke of midnight.
lcStopTime = SYS(2)
lnStartTime = SECONDS()