SetClock

Description:              This statement sets the VTS system clock and calendar.

Returns:                    Nothing

Usage:                   Script

Format:                      SetClock(Date, Time)

Parameters:             Date    { numeric }  { required }  { no default: }

                                                Any numeric expression giving the new date, in days since 1 January 1970.

                                    Time    { numeric }  { required }  { no default: }

                                                Any numeric expression giving the new time, in seconds since midnight.

Comments:               This statement allows the synchronization of the VTS system clock/calendar with another clock/calendar. All pending timers, and all built-in statements and functions that depend on the system clock/calendar are adjusted accordingly. Caution is necessary, because VTS will not adjust times and dates stored in variables or files (VTS doesn't know if a variable contains a number or time or date). I/O drivers which time and date stamp results will not adjust themselves retroactively; however, as each new action occurs, the new time and date will be used. This is because I/O drivers are not built-in functions, they are modules.

Example:

If ZEditField(10, 40, 110, 10, minPastHr, 2, 1, 1);

[

  currTime = Seconds();

  minPastHr = Cast(minPastHr, 0){ Type status (0 - 255) }; 

  minPastHr %= 60 { Valid range is from 0 - 60 }; 

  convTime = currTime { Seconds since midnight } 

  - currTime % 24 { Seconds past the hour } 

  + (minPastHr * 60){ New seconds past the hour }; 

  SetClock(Today(), convTime) { Set the system clock };

]

This takes a value that has been entered into an input field and sets the system clock by it. The date and hour remain unchanged, only the minutes are set.

See Also:

Seconds | Today