主要内容

DateTime Time Standard Converter

R2026b

Convert between DateTime time standards

Since R2026b

  • DateTime Time Standard Converter block icon

Libraries:
Simulink / DateTime

Description

The DateTime Time Standard Converter block converts a DateTime signal between time standard formats.

Examples

expand all

This example shows how the DateTime Time Standard Converter block converts a DateTime signal from one time standard to another. The model contains three DateTime Clock blocks: ZeroLeapSeconds, OneLeapSecond, and AllLeapSeconds.

DateTime Clock block ZeroLeapSeconds outputs a DateTime signal with time standard UTC and is set to 12:00 AM UTC, January 1, 1970 at simulation time 0. This is before any leap seconds are inserted into UTC. The UTC output of ZeroLeapSeconds is converted to time standards TAI and TT, respectively, by the DateTime Time Standard Converter blocks ZeroToTAI and ZeroToTT. The TAI output is 10 seconds ahead of the UTC output. The TT output is 42.184 seconds ahead of the UTC output, but this difference is truncated to 42 seconds.

DateTime Clock block OneLeapSecond is set to 12:00 AM UTC, July 1, 1972, immediately after the first leap second was added. Its output is converted by the DateTime Time Standard Converter blocks OneToTAI and OneToTT. The difference between TAI and UTC signals has increased to 11 seconds, while the TT-UTC difference is now 43.184 seconds, truncated to 43 seconds.

DateTime Clock block AllLeapSeconds is set to 12:00 AM UTC, January 1, 2017, immediately after the most recent leap second was added. Its output is converted by the DateTime Time Standard Converter blocks AllToTAI and AllToTT. The TAI-UTC difference is 37 seconds, while the TT-UTC difference is 69.184 seconds, truncated to 69 seconds.

model='ex_datetime_time_standard_converter_block';
load_system(model)
sim(model);
open_system(model)

Ports

Input

expand all

DateTime signal to be converted, specified as a scalar.

If the Account for new leap seconds after simulation start parameter of the DateTime Clock is cleared, do not use the output from that block as the input for the DateTime Time Standard Converter block.

Output

expand all

Converted DateTime signal in new time standard, returned as a scalar DateTime signal.

Parameters

expand all

To edit block parameters interactively, use the Property Inspector. From the Simulink® Toolstrip, on the Simulation tab, in the Prepare gallery, select Property Inspector.

Specify the time standard conversion:

  • TAI to UTC

  • TAI to TT

  • UTC to TAI

  • UTC to TT

  • TT to TAI

  • TT to UTC

Programmatic Use

To set the block parameter value programmatically, use the set_param function.

To get the block parameter value programmatically, use the get_param function.

Parameter: TimeStandardConversion
Values: TAI to UTC (default) | TAI to TT | UTC to TAI | UTC to TT | TT to TAI | TT to UTC

Block Characteristics

Data Types

Boolean | bus | datetime

Direct Feedthrough

yes

Multidimensional Signals

no

Variable-Size Signals

no

Zero-Crossing Detection

no

Extended Capabilities

expand all

C/C++ Code Generation
Generate C and C++ code using Simulink® Coder™.

Version History

Introduced in R2026b