Computation Time Sample Time navigation bar

Table of Contents

Date/Time

Outputs the current date and/or time.

Library

QUARC Targets/Sources/Time

Description

Date/Time

The Date/Time block outputs the current date and/or time in the local timezone or in UTC time.

Input Ports

This block has no input ports.

Output Ports

The outputs of this block are determined by the Output the date, Output the time and Output the seconds since the January 1, 1970 epoch parameters. If the Output the date option is checked then the year, mon and day outputs are present. If the Output the time option is checked then the hour, min, sec and nsec outputs are present. If the Output the seconds since the January 1, 1970 epoch option is checked then the epoch output is present.

year

The current year as a 16-bit unsigned integer. This output is only present if the Output the date option is checked.

mon

The current month as an 8-bit unsigned integer, in the range 1 to 12, in which 1 indicates January and 12 indicates December. This output is only present if the Output the date option is checked.

day

The current day of the month as an 8-bit unsigned integer, in the range 1 to 31. This output is only present if the Output the date option is checked.

hour

The current hour of the day as an 8-bit unsigned integer, in the range 0 to 23. This output is only present if the Output the time option is checked.

min

The current minute within the hour as an 8-bit unsigned integer, in the range 0 to 59. This output is only present if the Output the time option is checked.

sec

The current second within the minute as an 8-bit unsigned integer, in the range 0 to 59. This output is only present if the Output the time option is checked.

nsec

The current nanoseconds within the second as a 32-bit unsigned integer, in the range 0 to 999999999. This output is only present if the Output the time option is checked. This output may not have nanosecond resolution but is expressed in nanosecond units.

epoch

The current number of seconds since midnight on January 1, 1970 as a double-precision floating-point value. The resolution may be up to the nanosecond. This output is only present if the Output the seconds since the January 1, 1970 epoch option is checked.

Parameters and Dialog Box

Date/Time

Output the date

Check this option to output the current year, month and day from the block. Whether this date is in local time or UTC time depends on the Use UTC time parameter.

Output the time

Check this option to output the current hour, minute, second and nanosecond from the block. Whether this time is in local time or UTC time depends on the Use UTC time parameter.

Output the seconds since the January 1, 1970 epoch

Check this option to output the current number of seconds since midnight on January 1, 1970, which is commonly called the Unix epoch. This output is not affected by the Use UTC time parameter.

Use UTC time

If this option is checked then the date and time output from the block are in UTC time. If it is unchecked then the date and time outputs are in local time.

Sample time

The sample time of the block. A sample time of 0 indicates that the block will be treated as a continuous time block. A positive sample time indicates that the block is a discrete time block with the given sample time.

A sample time of -1 indicates that the block inherits its sample time. Since this is a source block, only inherent the sample time when it is placed in a conditionally executed subsystem, like a Triggered Subsystem, Enabled Subsystem, Function Call Subsystem or in a referenced model.

To use the fundamental sampling time of the model, set the sample time to qc_get_step_size, which is a QUARC function that returns the fundamental sampling time of the model.

The default sample time is set to max(1,qc_get_step_size) so that a sample time of no faster than one second is used. A faster sample time is unnecessary because time is only output down to the second from this block.

Targets

Target Name

Compatible*

Model Referencing

Comments

QUARC Win32 Target

Yes

Yes

QUARC Win64 Target

Yes

Yes

QUARC Linux Nvidia Target

Yes

Yes

QUARC Linux QBot Platform Target

Yes

Yes

QUARC Linux QCar 2 Target

Yes

Yes

QUARC Linux QDrone 2 Target

Yes

Yes

QUARC Linux Raspberry Pi 3 Target

Yes

Yes

QUARC Linux Raspberry Pi 4 Target

Yes

Yes

QUARC Linux RT ARMv7 Target

Yes

Yes

QUARC Linux x64 Target

Yes

Yes

QUARC Linux DuoVero Target

Yes

Yes

QUARC Linux DuoVero 2016 Target

Yes

Yes

QUARC Linux Verdex Target

Yes

Yes

QUARC QNX x86 Target

Yes

Yes

Last fully supported in QUARC 2018.

Rapid Simulation (RSIM) Target

Yes

Yes

S-Function Target

No

N/A

Old technology. Use model referencing instead.

Normal simulation

Yes

Yes

* Compatible means that the block can be compiled for the target.

 

navigation bar