DEENESPTFRRUARHIKOZHNL

类 ara::core::SteadyClock

[SWS_CORE_06401] Upstream: RS_AP_00130

class SteadyClock final {...};

This clock represents a monotonic clock. The time points of this clock cannot decrease as physical time moves forward and the time between ticks of this clock is constant.

Header-Datei#include "ara/core/steady_clock.h"
Forwarding-Header#include "ara/core/core_fwd.h"
Scopenamespace ara::core

用户指南人工智能生成

提供具有纳秒分辨率的严格单调时钟,用于时间无关的区间测量和期限监控。
AI 生成 未审核 模型: gemini-3.8-flash-medium · 推理强度: medium · 温度: 不可控 · 提示词: c5876cb77c90 来源 未决问题(2)
译自德文指南gemini-3.8-flash-low · 2026-10-13 · 德文原文

提供具有纳秒分辨率的严格单调时钟,用于时间无关的区间测量和期限监控。

该类提供具有纳秒分辨率的单调、均匀时钟,用于测量时间段和期限,其时间点绝不递减([SWS_CORE_06431]、[SWS_CORE_06413])。通过静态函数 now(),应用程序可以线程安全且无异常风险地获取当前时间戳 [SWS_CORE_06432]。通过求两个时间点之间的差值,可以稳健地确定操作的执行持续时间。

上下文

类 ara::core::SteadyClock 在 AUTOSAR Adaptive Platform 中提供用于精确时间测量的单调时钟。其主要职责是提供持续递增的时间点;随着物理时间的推移,此时钟的时间点绝不递减,且滴答(tick)之间的持续时间是恒定的。通过属性 is_steady = true [SWS_CORE_06431] 保证了这种不变性。

该类的时间模型借鉴了 C++ 标准时钟概念,并对时间间隔和时间点的度量单位进行了标准化。时钟的滴答周期通过类型别名 period 定义为纳秒([SWS_CORE_06413]:using period = std::nano)。滴答计数采用有符号 64 位整数类型作为表示类型([SWS_CORE_06412]:using rep = std::int64_t)。在此基础上,using duration = std::chrono::duration<rep, period> [SWS_CORE_06411] 映射相对时间间隔,而 using time_point = std::chrono::time_point<SteadyClock, duration> [SWS_CORE_06414] 将特定时间点绑定到此时钟。典型的交互伙伴是需要确定执行持续时间或监控期限的应用程序组件。

生命周期

该类被指定为 final 且仅包含静态接口。解释:对于实际使用而言,既没有计划也不需要实例化 ara::core::SteadyClock,因为该类充当 time_point 的静态命名空间和类型标识符。 问题 Q-08b479dc497c8f74 (未决)不存在状态转换、初始化阶段或析构例程。

对于来自多个线程的并发访问,核心查询函数 now() 被明确指定为线程安全的(thread-safe)[SWS_CORE_06432]。因此,多个线程可以并发且无需额外外部同步地获取时间戳。

使用路径

ara::core::SteadyClock 的典型使用路径是测量程序段的执行持续时间。开始时,调用者通过静态方法 ara::core::SteadyClock::now() [SWS_CORE_06432] 查询当前时间戳,从而返回一个 time_point [SWS_CORE_06414] 类型的对象。随后应用程序执行预定的操作。在该操作完成后,再次调用 now() [SWS_CORE_06432]。通过从结束时间点减去起始时间点,应用程序计算出流逝的持续时间作为 duration [SWS_CORE_06411]。由于 is_steady 保证时钟绝不倒流 [SWS_CORE_06431],因此随着物理时间的推移,结果始终是单调且可靠的。

使用 ara::core::SteadyClock 进行时间间隔测量应用SteadyClocknow()t_start: time_point执行操作now()t_ende: time_pointDauer = t_ende - t_start

时序图:通过确定两个时间点进行持续时间测量的典型流程。来源:[SWS_CORE_06432]、[SWS_CORE_06411]、[SWS_CORE_06414]

错误场景

ara::core::SteadyClock 的接口未提供错误代码或错误状态。函数 now() 被声明为 noexcept 并具有异常安全(exception safe)属性 [SWS_CORE_06432]。对 now() 的调用在任何常规运行条件下都不会失败,并保证返回 time_point [SWS_CORE_06414] 类型的有效值。

解释:计数器 rep [SWS_CORE_06412] 的理论数值溢出,在实际系统中鉴于纳秒滴答下的 64 位值范围,按计算在运行数百年后才会发生,因此不构成实际的错误风险。 问题 Q-9ce575da867b8203 (未决)

本指南基于 AUTOSAR Adaptive Platform 规范 Release R25-11。

成员图

方法

1

常量

1

类图

Hohle Dreieckspfeile = Vererbung (zeigt zur Basisklasse); Klicken öffnet die jeweilige Klassenseite.

G nara__core__SteadyClock455 SteadyClock + is_steady + now()

详细视图

请在大纲中选择一个条目。

方法

now 函数

Return a time_point representing the current value of the clock.

static time_point now () noexcept;

类型别名

duration 类型别名

std::chrono::duration<rep, period> ≙ std::chrono::duration

using duration = std::chrono::duration<rep, period>;
period 类型别名

A std::ratio type representing the tick period of the clock, in seconds . ≙ std::ratio

using period = std::nano;
rep 类型别名

An arithmetic type representing the number of ticks in the clock’s duration .

using rep = std::int64_t;
time_point 类型别名

std::chrono::time_point<ara::core::SteadyClock> ≙ std::chrono::time_point

常量

is_steady 变量

steady clock flag, always true

static constexpr bool is_steady = true;

方法文档

函数 now [SWS_CORE_06432] Upstream: RS_AP_00130

static time_point now () noexcept;

Return a time_point representing the current value of the clock.

AI 生成 未审核 模型: gemini-3.8-flash-medium · 推理强度: medium · 温度: 不可控 · 提示词: 24ebb1344fe4 来源 未决问题(1)
译自德文指南gemini-3.8-flash-low · 2026-10-13 · 德文原文

静态函数 ara::core::SteadyClock::now() 同步返回一个 time_point,表示时钟的当前计数值 [SWS_CORE_06432]。使用时需包含头文件 ara/core/steady_clock.h [SWS_CORE_06432]。由于该方法静态绑定到 ara::core::SteadyClock,因此无需对该类进行实例化;可直接通过作用域进行访问。

关于错误处理,该函数使用 noexcept 声明,并标明为异常安全(exception safe)[SWS_CORE_06432]。因此,调用方无需为时间查询提供异常处理,因为该操作保证无错误返回。

关于并发性和限制,now() 被指定为线程安全(thread-safe)[SWS_CORE_06432]。允许在无需应用侧同步的情况下,从任意执行上下文和线程中并行调用该函数。

在 ara::core::SteadyClock 的接口内,该函数的主要用途推测是为相对时间间隔测量和运行时间确定提供时间点(解释:由作用域和返回类型 [SWS_CORE_06432] 推导得出)。 问题 Q-34b2317714fd4e03 (未决)

本使用说明由系统自动生成,基于 AUTOSAR Adaptive R25-11 规范。

Header-Datei#include "ara/core/steady_clock.h"
Scopeclass ara::core::SteadyClock
Exception-Sicherheitexception safe
Thread-Sicherheitthread-safe

Rückgabewert

TypBeschreibung
time_pointa time_point

Request a governed re-review of this record. The record is not changed immediately.

Record
AUTOSAR/AP/record/SWS_CORE_06432
Status
valid/unmigrated
Version
AUTOSAR/AP/record/SWS_CORE_06432@rel:R25-11#d718975c
Content hash
d718975c
Source
https://www.autosar.org/fileadmin/standards/R25-11/AP/AUTOSAR_AP_SWS_Core.pdf#nameddest=SWS_CORE_06432
Status: valid/unmigrated Version: rel:R25-11#5c6a8c47 Versionshistorie & Revisions (1 transition, 7 revision)
Current State
valid/unmigrated
Reason
mechanically backfilled by migriere_status_backfill.py -- no per-field curation history exists yet for this record
Campaign
2026-08-13-status-backfill
Active Version
AUTOSAR/AP/record/SWS_CORE_06432@rel:R25-11#5c6a8c47
Point-in-Time History:
Recorded Revisions (7):
  • R25-11rel:R25-11#bd3e18002026-09-30
  • R20-11rel:R20-11#2ebaac9e2026-10-14
  • R21-11rel:R21-11#2ebaac9e2026-10-14
  • R22-11rel:R22-11#23f195162026-10-14
  • R23-11rel:R23-11#1e8f88b82026-10-14
  • R24-11rel:R24-11#5c6a8c472026-10-14
  • R25-11rel:R25-11#5c6a8c472026-10-14 active
DateActorTransitionReason / RationaleCampaign
2026-08-13toolnone → valid/unmigratedmechanically backfilled by migriere_status_backfill.py -- no per-field curation history exists yet for this record2026-08-13-status-backfill

类型别名文档

类型别名 duration [SWS_CORE_06411] Upstream: RS_AP_00130

using duration = std::chrono::duration<rep, period>;

std::chrono::duration<rep, period>

Header-Datei#include "ara/core/steady_clock.h"
Scopeclass ara::core::SteadyClock
Symbolduration

Request a governed re-review of this record. The record is not changed immediately.

Record
AUTOSAR/AP/record/SWS_CORE_06411
Status
valid/unmigrated
Version
AUTOSAR/AP/record/SWS_CORE_06411@rel:R25-11#d03e91cf
Content hash
d03e91cf
Source
https://www.autosar.org/fileadmin/standards/R25-11/AP/AUTOSAR_AP_SWS_Core.pdf#nameddest=SWS_CORE_06411
Status: valid/unmigrated Version: rel:R25-11#604e5eff Versionshistorie & Revisions (1 transition, 7 revision)
Current State
valid/unmigrated
Reason
mechanically backfilled by migriere_status_backfill.py -- no per-field curation history exists yet for this record
Campaign
2026-08-13-status-backfill
Active Version
AUTOSAR/AP/record/SWS_CORE_06411@rel:R25-11#604e5eff
Point-in-Time History:
Recorded Revisions (7):
  • R25-11rel:R25-11#8d0579d82026-09-30
  • R20-11rel:R20-11#0b720af62026-10-14
  • R21-11rel:R21-11#0b720af62026-10-14
  • R22-11rel:R22-11#da4c16bd2026-10-14
  • R23-11rel:R23-11#604e5eff2026-10-14
  • R24-11rel:R24-11#604e5eff2026-10-14
  • R25-11rel:R25-11#604e5eff2026-10-14 active
DateActorTransitionReason / RationaleCampaign
2026-08-13toolnone → valid/unmigratedmechanically backfilled by migriere_status_backfill.py -- no per-field curation history exists yet for this record2026-08-13-status-backfill

类型别名 period [SWS_CORE_06413] Upstream: RS_AP_00130

using period = std::nano;

A std::ratio type representing the tick period of the clock, in seconds .

Header-Datei#include "ara/core/steady_clock.h"
Scopeclass ara::core::SteadyClock
Symbolperiod

Request a governed re-review of this record. The record is not changed immediately.

Record
AUTOSAR/AP/record/SWS_CORE_06413
Status
valid/unmigrated
Version
AUTOSAR/AP/record/SWS_CORE_06413@rel:R25-11#3ee7dcaf
Content hash
3ee7dcaf
Source
https://www.autosar.org/fileadmin/standards/R25-11/AP/AUTOSAR_AP_SWS_Core.pdf#nameddest=SWS_CORE_06413
Status: valid/unmigrated Version: rel:R25-11#23d3f8ae Versionshistorie & Revisions (1 transition, 7 revision)
Current State
valid/unmigrated
Reason
mechanically backfilled by migriere_status_backfill.py -- no per-field curation history exists yet for this record
Campaign
2026-08-13-status-backfill
Active Version
AUTOSAR/AP/record/SWS_CORE_06413@rel:R25-11#23d3f8ae
Point-in-Time History:
Recorded Revisions (7):
  • R25-11rel:R25-11#b4ea22ad2026-09-30
  • R20-11rel:R20-11#736232b22026-10-14
  • R21-11rel:R21-11#736232b22026-10-14
  • R22-11rel:R22-11#7d2f0f372026-10-14
  • R23-11rel:R23-11#23d3f8ae2026-10-14
  • R24-11rel:R24-11#23d3f8ae2026-10-14
  • R25-11rel:R25-11#23d3f8ae2026-10-14 active
DateActorTransitionReason / RationaleCampaign
2026-08-13toolnone → valid/unmigratedmechanically backfilled by migriere_status_backfill.py -- no per-field curation history exists yet for this record2026-08-13-status-backfill

类型别名 rep [SWS_CORE_06412] Upstream: RS_AP_00130

using rep = std::int64_t;

An arithmetic type representing the number of ticks in the clock’s duration .

Header-Datei#include "ara/core/steady_clock.h"
Scopeclass ara::core::SteadyClock
Symbolrep

Request a governed re-review of this record. The record is not changed immediately.

Record
AUTOSAR/AP/record/SWS_CORE_06412
Status
valid/unmigrated
Version
AUTOSAR/AP/record/SWS_CORE_06412@rel:R25-11#979e14b4
Content hash
979e14b4
Source
https://www.autosar.org/fileadmin/standards/R25-11/AP/AUTOSAR_AP_SWS_Core.pdf#nameddest=SWS_CORE_06412
Status: valid/unmigrated Version: rel:R25-11#2bb738d9 Versionshistorie & Revisions (1 transition, 7 revision)
Current State
valid/unmigrated
Reason
mechanically backfilled by migriere_status_backfill.py -- no per-field curation history exists yet for this record
Campaign
2026-08-13-status-backfill
Active Version
AUTOSAR/AP/record/SWS_CORE_06412@rel:R25-11#2bb738d9
Point-in-Time History:
Recorded Revisions (7):
  • R25-11rel:R25-11#bf21afd72026-09-30
  • R20-11rel:R20-11#a465a7e92026-10-14
  • R21-11rel:R21-11#00a900252026-10-14
  • R22-11rel:R22-11#12d2049d2026-10-14
  • R23-11rel:R23-11#9dca85212026-10-14
  • R24-11rel:R24-11#9dca85212026-10-14
  • R25-11rel:R25-11#2bb738d92026-10-14 active
DateActorTransitionReason / RationaleCampaign
2026-08-13toolnone → valid/unmigratedmechanically backfilled by migriere_status_backfill.py -- no per-field curation history exists yet for this record2026-08-13-status-backfill

类型别名 time_point [SWS_CORE_06414] Upstream: RS_AP_00130

using time_point = std::chrono::time_point<SteadyClock, duration>;

std::chrono::time_point<ara::core::SteadyClock>

Header-Datei#include "ara/core/steady_clock.h"
Scopeclass ara::core::SteadyClock
Symboltime_point

Request a governed re-review of this record. The record is not changed immediately.

Record
AUTOSAR/AP/record/SWS_CORE_06414
Status
valid/unmigrated
Version
AUTOSAR/AP/record/SWS_CORE_06414@rel:R25-11#fdb07b70
Content hash
fdb07b70
Source
https://www.autosar.org/fileadmin/standards/R25-11/AP/AUTOSAR_AP_SWS_Core.pdf#nameddest=SWS_CORE_06414
Status: valid/unmigrated Version: rel:R25-11#1b006689 Versionshistorie & Revisions (1 transition, 7 revision)
Current State
valid/unmigrated
Reason
mechanically backfilled by migriere_status_backfill.py -- no per-field curation history exists yet for this record
Campaign
2026-08-13-status-backfill
Active Version
AUTOSAR/AP/record/SWS_CORE_06414@rel:R25-11#1b006689
Point-in-Time History:
Recorded Revisions (7):
  • R25-11rel:R25-11#1aef719d2026-09-30
  • R20-11rel:R20-11#c8d776632026-10-14
  • R21-11rel:R21-11#dc1e7e5a2026-10-14
  • R22-11rel:R22-11#8a18d9d52026-10-14
  • R23-11rel:R23-11#9f525c1b2026-10-14
  • R24-11rel:R24-11#1b0066892026-10-14
  • R25-11rel:R25-11#1b0066892026-10-14 active
DateActorTransitionReason / RationaleCampaign
2026-08-13toolnone → valid/unmigratedmechanically backfilled by migriere_status_backfill.py -- no per-field curation history exists yet for this record2026-08-13-status-backfill

常量 / 变量文档

变量 is_steady [SWS_CORE_06431] Upstream: RS_AP_00130

static constexpr bool is_steady = true;

steady clock flag, always true

Header-Datei#include "ara/core/steady_clock.h"
Scopeclass ara::core::SteadyClock
Symbolis_steady
Typbool

Request a governed re-review of this record. The record is not changed immediately.

Record
AUTOSAR/AP/record/SWS_CORE_06431
Status
valid/unmigrated
Version
AUTOSAR/AP/record/SWS_CORE_06431@rel:R25-11#715e8296
Content hash
715e8296
Source
https://www.autosar.org/fileadmin/standards/R25-11/AP/AUTOSAR_AP_SWS_Core.pdf#nameddest=SWS_CORE_06431
Status: valid/unmigrated Version: rel:R25-11#577f28aa Versionshistorie & Revisions (1 transition, 7 revision)
Current State
valid/unmigrated
Reason
mechanically backfilled by migriere_status_backfill.py -- no per-field curation history exists yet for this record
Campaign
2026-08-13-status-backfill
Active Version
AUTOSAR/AP/record/SWS_CORE_06431@rel:R25-11#577f28aa
Point-in-Time History:
Recorded Revisions (7):
  • R25-11rel:R25-11#cc7c9da82026-09-30
  • R20-11rel:R20-11#07665d652026-10-14
  • R21-11rel:R21-11#737caacf2026-10-14
  • R22-11rel:R22-11#6d708f332026-10-14
  • R23-11rel:R23-11#577f28aa2026-10-14
  • R24-11rel:R24-11#577f28aa2026-10-14
  • R25-11rel:R25-11#577f28aa2026-10-14 active
DateActorTransitionReason / RationaleCampaign
2026-08-13toolnone → valid/unmigratedmechanically backfilled by migriere_status_backfill.py -- no per-field curation history exists yet for this record2026-08-13-status-backfill