S2OPC OPCUA Toolkit
Loading...
Searching...
No Matches
sopc_date_time.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
20#ifndef SOPC_TIME_H_
21#define SOPC_TIME_H_
22
23#include <inttypes.h>
24#include <stdbool.h>
25#include <stddef.h>
26#include <time.h>
27
28#include "sopc_builtintypes.h"
29#include "sopc_enums.h"
30
35
45
58char* SOPC_Time_GetString(SOPC_DateTime time, bool local, bool compact);
59
70
81
91
101
111
121
126typedef struct SOPC_tm
127{
128 int16_t year;
129 uint8_t month;
130 uint8_t day;
131 uint8_t hour;
132 uint8_t minute;
133 uint8_t second;
135 bool UTC;
138 uint8_t UTC_hour_off;
139 uint8_t UTC_min_off;
141
163bool SOPC_tm_FromXsdDateTime(const char* datetime, size_t len, SOPC_tm* tm);
164
182SOPC_ReturnStatus SOPC_Time_FromXsdDateTime(const char* dateTime, size_t len, int64_t* res);
183
184#endif /* SOPC_TIME_H_ */
int64_t time_t
Definition p_time_c99.h:42
int64_t SOPC_DateTime
OPC UA timestamp format which is 100 nanoseconds from 1601/01/01 00:00:00 UTC.
Definition sopc_builtintypes.h:160
SOPC_ReturnStatus SOPC_Time_ToUnixTime(SOPC_DateTime dt, SOPC_Unix_Time *res)
Converts a time expressed in 100ns slices since 1601/01/01 00:00:00 UTC to a UNIX timestamp.
SOPC_DateTime SOPC_Time_GetCurrentTimeUTC(void)
return the current time in DateTime format which is 100 nanoseconds from 1601/01/01 00:00:00 UTC
char * SOPC_Time_GetStringOfCurrentLocalTime(bool compact)
return the current local time as a C String, e.g.:
SOPC_ReturnStatus SOPC_Time_FromUnixTime(SOPC_Unix_Time time, SOPC_DateTime *res)
Converts a UNIX timestamp to a time expressed in 100ns slices since 1601/01/01 00:00:00 UTC.
SOPC_ReturnStatus SOPC_Time_FromXsdDateTime(const char *dateTime, size_t len, int64_t *res)
Converts a string using XSD DateTime format (see SOPC_tm_FromXsdDateTime) to a time expressed in 100n...
char * SOPC_Time_GetStringOfCurrentTimeUTC(bool compact)
return the current UTC time as a C String, e.g.:
time_t SOPC_Unix_Time
Definition sopc_date_time.h:34
struct SOPC_tm SOPC_tm
S2OPC equivalent of standard struct tm. Fields use fix-length numerical values.
SOPC_ReturnStatus SOPC_Time_Breakdown_Local(SOPC_Unix_Time t, struct tm *tm)
Breaks down a timestamp to its structured representation in local time.
SOPC_ReturnStatus SOPC_Time_Breakdown_UTC(SOPC_Unix_Time t, struct tm *tm)
Breaks down a timestamp to its structured representation in UTC time.
char * SOPC_Time_GetString(SOPC_DateTime time, bool local, bool compact)
returns a C string representation of the given time in DateTime format E.g.:
bool SOPC_tm_FromXsdDateTime(const char *datetime, size_t len, SOPC_tm *tm)
Parse a string containing an XSD format datetime '[YYYY]-[MM]-[DD]T[hh]:[mm]:[ss]',...
enum _SOPC_ReturnStatus SOPC_ReturnStatus
Common enumerations for S2OPC.
S2OPC equivalent of standard struct tm. Fields use fix-length numerical values.
Definition sopc_date_time.h:127
bool UTC_neg_off
Definition sopc_date_time.h:137
uint8_t UTC_min_off
Definition sopc_date_time.h:139
uint8_t day
Definition sopc_date_time.h:130
double secondAndFrac
Definition sopc_date_time.h:134
uint8_t second
Definition sopc_date_time.h:133
uint8_t UTC_hour_off
Definition sopc_date_time.h:138
uint8_t hour
Definition sopc_date_time.h:131
uint8_t month
Definition sopc_date_time.h:129
uint8_t minute
Definition sopc_date_time.h:132
bool UTC
Definition sopc_date_time.h:135
int16_t year
Definition sopc_date_time.h:128
Definition p_time_c99.h:27