S2OPC OPCUA Toolkit
Loading...
Searching...
No Matches
sopc_time_reference.h
Go to the documentation of this file.
1/*
2 * Licensed to Systerel under one or more contributor license
3 * agreements. See the NOTICE file distributed with this work
4 * for additional information regarding copyright ownership.
5 * Systerel licenses this file to you under the Apache
6 * License, Version 2.0 (the "License"); you may not use this
7 * file except in compliance with the License. You may obtain
8 * a copy of the License at
9 *
10 * http://www.apache.org/licenses/LICENSE-2.0
11 *
12 * Unless required by applicable law or agreed to in writing,
13 * software distributed under the License is distributed on an
14 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 * KIND, either express or implied. See the License for the
16 * specific language governing permissions and limitations
17 * under the License.
18 */
19
26#ifndef SOPC_TIME_REFERENCE_H_
27#define SOPC_TIME_REFERENCE_H_
28
41#ifndef SOPC_MONOTONIC_CLOCK
42#define SOPC_MONOTONIC_CLOCK true
43#endif
44
45#include <stdbool.h>
46#include <stdint.h>
47
52typedef uint64_t SOPC_TimeReference;
53
60
70
83
94
104
113
131 uint64_t duration_us,
132 int32_t offset_us);
133
144
152
161
170
176
187
188#endif // SOPC_TIME_REFERENCE_H_
void SOPC_HighRes_TimeReference_SleepUntil(const SOPC_HighRes_TimeReference *date)
Precise sleep until specified date.
int64_t SOPC_HighRes_TimeReference_DeltaUs(const SOPC_HighRes_TimeReference *tRef, const SOPC_HighRes_TimeReference *t)
Compare two SOPC_HighRes_TimeReference elements into microseconds.
void SOPC_HighRes_TimeReference_Delete(SOPC_HighRes_TimeReference **t)
Deletes a time reference.
SOPC_HighRes_TimeReference * SOPC_HighRes_TimeReference_Create(void)
Create a new time reference.
SOPC_TimeReference SOPC_TimeReference_GetCurrent(void)
return the current time reference
bool SOPC_HighRes_TimeReference_IsExpired(const SOPC_HighRes_TimeReference *t, const SOPC_HighRes_TimeReference *now)
Checks is a date is in the future (relatively to another date)
void SOPC_HighRes_TimeReference_AddSynchedDuration(SOPC_HighRes_TimeReference *t, uint64_t duration_us, int32_t offset_us)
Adds an offset to a SOPC_HighRes_TimeReference object, ensuring a specific time offset towards a sync...
SOPC_TimeReference SOPC_TimeReference_AddMilliseconds(SOPC_TimeReference timeRef, uint64_t ms)
return the time reference corresponding to the given time reference incremented by the given duration...
struct SOPC_HighRes_TimeReference SOPC_HighRes_TimeReference
Definition sopc_time_reference.h:59
int8_t SOPC_TimeReference_Compare(SOPC_TimeReference left, SOPC_TimeReference right)
return the comparison of given time references
void SOPC_HighRes_TimeReference_GetTime(SOPC_HighRes_TimeReference *t)
Store the current time in t.
uint64_t SOPC_TimeReference
Definition sopc_time_reference.h:52
void SOPC_HighRes_TimeReference_Copy(SOPC_HighRes_TimeReference *to, const SOPC_HighRes_TimeReference *from)
A copy of a non-NULL SOPC_HighRes_TimeReference structure.