Seconds

(Engine-Level Function)

Description: Returns the number of seconds since midnight of the current day.
Returns: Numeric
Usage: Script only.
Function Groups: Time and Date
Related to: AbsTime | CurrentTime | Now | Today
Format: Seconds()
Parameters:

None

Comments: Care must be taken when using this function together with the Today function to determine the current date and time. If the time is within a fraction of a second of midnight, the value of the date may be calculated in one day and the time in the other day giving an apparent error of almost 24 hours. In situations where this is a problem, the AbsTime function may be helpful, however, the best practice is to use the function CurrentTime.

Examples:

If 1 Main;
[
  timeStamp = Seconds();
]

This assigns the current time in seconds since midnight to the floating point (or long) variable timeStamp. Another example of how this function could be used is:

If 1 Main;
[
  start = Seconds();
  FRead(1, "G:\TOTALS\BARTOTAL.DAT", 120, "%40c", bar4Total);
  duration = Seconds() - start { Compute time for network
  server disk read };
]

This example shows how to measure the execution time of various functions in a script. This provides information on how to improve the performance of the application. In this case, if the time is too long, it may be useful to install a disk drive cache such as SMARTDRV.