Documentation

SimulinkRealTime.utils.setTargetSystemTime

Sets the value of the target computer system clock

Syntax

SimulinkRealTime.utils.setTargetSystemTime
SimulinkRealTime.utils.setTargetSystemTime(date_vector)
SimulinkRealTime.utils.setTargetSystemTime(target_object, ___)

Description

example

SimulinkRealTime.utils.setTargetSystemTime sets the default target computer system time to the current value of the development computer system time (UTC). The target computer must be running and in communication with the development computer. You do not have to use the target computer keyboard or restart the target computer.

example

SimulinkRealTime.utils.setTargetSystemTime(date_vector) sets the default target computer system time to the specified value, passed as a date vector.

example

SimulinkRealTime.utils.setTargetSystemTime(target_object, ___) sets the specified target computer system time to the specified value, passed as a date vector.

Examples

collapse all

Change system time of default target computer to the development computer system time

Show original system time.

date_vector = SimulinkRealTime.utils.getTargetSystemTime
date_vector =

  Columns 1 through 4

        2015          11           4          19

  Columns 5 through 6

          15          56

Change system time.

SimulinkRealTime.utils.setTargetSystemTime;

Show new system time.

date_vector = SimulinkRealTime.utils.getTargetSystemTime
date_vector =

  Columns 1 through 4

        2015          11           4          19

  Columns 5 through 6

          15          57

Change system time of default target computer to the specified system time

Show original system time.

date_vector = SimulinkRealTime.utils.getTargetSystemTime
date_vector =

  Columns 1 through 4

        2015          11           4          19

  Columns 5 through 6

          15          57

Change system time to

new_date_vector = [2015, 11, 5, 14, 15, 0];
SimulinkRealTime.utils.setTargetSystemTime(new_date_vector);

Show new system time.

date_vector = SimulinkRealTime.utils.getTargetSystemTime
date_vector =

  Columns 1 through 4

        2015          11           5          14

  Columns 5 through 6

          15           0

Change system time of target computer 'TargetPC1' to the development computer system time

Show original system time.

target_object = SimulinkRealTime.target('TargetPC1');
date_vector = ...
     SimulinkRealTime.utils.getTargetSystemTime(target_object)
date_vector =

  Columns 1 through 4

        2015          11           5          14

  Columns 5 through 6

          15           0

Change system time.

SimulinkRealTime.utils.setTargetSystemTime(target_object);

Show new system time.

date_vector = ...
     SimulinkRealTime.utils.getTargetSystemTime(target_object)
date_vector =

  Columns 1 through 4

        2015          11           4          19

  Columns 5 through 6

          15          57

Input Arguments

collapse all

Object that represents the target computer. Before calling this function, make sure that you start the target computer with the Simulink® Real-Time™ kernel and apply the required Ethernet link settings.

Example: tg

Date and time as returned by the datevec function

Example: [2015, 11, 5, 14, 15, 0]

Data Types: double

Introduced in R2016a

Was this topic helpful?