---
url: /dyad/dev/stdlib/DiscreteComponents/components/SampleTimeSource.md
description: >-
  Dyad SampleTimeSource docs.  Outputs the time since the last sample on the
  clock that is connected to y.
---

# `SampleTimeSource` {#SampleTimeSource}

Outputs the time since the last sample on the clock that is connected to `y`.

::: warning Warning

Currently only works for `PeriodicClock`s.   Event clock support is planned for the future.

:::

## Usage {#Usage}

`DiscreteComponents.SampleTimeSource()`

## Connectors {#Connectors}

* `y` - This connector represents a real signal as an output from a component ([`RealOutput`](/stdlib/Dyad/connectors/RealOutput#RealOutput))

## Behavior {#Behavior}

Behavior of this component cannot be rendered because it includes `path` variables.

## Source {#Source}

```dyad
"""
Outputs the time since the last sample on the clock that is connected to `y`.

!!! warning
    Currently only works for `PeriodicClock`s.  
    Event clock support is planned for the future.
"""
external component SampleTimeSource@[input clk]
  y = RealOutput@[clk]() {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 960, "y1": 450, "x2": 1060, "y2": 550, "rot": 0}
      },
      "tags": []
    }
  }
relations
metadata {
  "Dyad": {
    "icons": {"default": "dyad://DiscreteComponents/SampleTimeSource.svg"},
    "doc": {"behavior": false}
  }
}
end
```

```dyad
"""
Outputs the time since the last sample on the clock that is connected to `y`.

!!! warning
    Currently only works for `PeriodicClock`s.  
    Event clock support is planned for the future.
"""
external component SampleTimeSource
  y = RealOutput@[clk]() {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 960, "y1": 450, "x2": 1060, "y2": 550, "rot": 0}
      },
      "tags": []
    }
  }
relations
metadata {
  "Dyad": {
    "icons": {"default": "dyad://DiscreteComponents/SampleTimeSource.svg"},
    "doc": {"behavior": false}
  }
}
end
```

## Test Cases {#Test-Cases}

No test cases defined.

## Related {#Related}

* Examples

* Experiments

* Analyses
