Variables storing dates and times (sys.Date, sys.Time, sys.SysTime, sys.LocalTime)ΒΆ

!temp sys.Date,,i4/dn

System date

!temp sys.Time,,u4/ts

System time

!temp sys.SysTime,,u4/es

System time in elapsed seconds

!temp sys.LocalTime,,u4/es

Corrected system time in elapsed seconds

New in version 6.3.0: See the new features.

!temp sys.MilliSecs,,u8,””###############0”

Current system time in milliseconds

System date and time fields. Cannot be updated.

sys.Date

The system date. This field is updated from the system clock every time its value is read, unless a value has been assigned to the field. In this case, automatic updating from the system date ceases for the remaining duration of the program and the stored value is preserved.

sys.Time

The current time from the system, continuously updated. Stored as seconds, starting from midnight which is 0, and prints and displays in hh:mm:ss format.

sys.SysTime

The system time in elapsed seconds from 00.00 January 1st, 1970 GMT. Always set to Greenwich Mean Time.

The logical type of this field can be changed to td (date and time), in which case it returns the correct date and time. This is done by use of a logical type flag at run time, as follows:

sys.SysTime->logical_type = LT_DTIME

This variable can be used to calculate time differences and to seed the random number generator.

sys.LocalTime

This field is identical to sys.SysTime, except that it is corrected for the local time zone and for daylight savings.

sys.MilliSecs

The current system time in milliseconds. Use to measure elapsed time with millisecond accuracy.

Note

The equivalent values on a remote server are accessed by means of the server_time() function.


EXAMPLE

  1. Display current date:

    +textbox DateBox at 70,4 {
        field = sys.Date
        label = "DATE"
    }
    
        display DateBox
    
  2. Time an update procedure:

    tmp.TimeSave = sys.SysTime
    UpdateEverything()
    tmp.TimeTaken = sys.SysTime - tmp.Time
    

RELATED TOPICS

Logical field types