diff --git a/Native/OpenDDSWrapper/TimeValueWrapper.h b/Native/OpenDDSWrapper/TimeValueWrapper.h
index ba5e1717..692d98ac 100644
--- a/Native/OpenDDSWrapper/TimeValueWrapper.h
+++ b/Native/OpenDDSWrapper/TimeValueWrapper.h
@@ -19,20 +19,16 @@ along with OpenDDSharp. If not, see .
**********************************************************************/
#pragma once
-#include "Utils.h"
-#include "dds/DCPS/TimeDuration.h"
+#include
-EXTERN_STRUCT_EXPORT TimeValueWrapper {
- CORBA::LongLong sec;
- CORBA::Long microsec;
+#pragma pack(push, 1)
+EXTERN_STRUCT_EXPORT
+TimeValueWrapper {
+ ::CORBA::LongLong sec;
+ ::CORBA::Long microsec;
public:
- TimeValueWrapper() {
- sec = 0;
- microsec = 0;
- }
-
TimeValueWrapper(const ::OpenDDS::DCPS::TimeDuration td) {
sec = td.value().sec();
microsec = td.value().usec();
@@ -42,3 +38,4 @@ EXTERN_STRUCT_EXPORT TimeValueWrapper {
return ::OpenDDS::DCPS::TimeDuration(sec, microsec);
}
};
+#pragma pack(pop)
diff --git a/Native/OpenDDSWrapper/TransportConfig.cpp b/Native/OpenDDSWrapper/TransportConfig.cpp
index 326f6968..83de0b4a 100644
--- a/Native/OpenDDSWrapper/TransportConfig.cpp
+++ b/Native/OpenDDSWrapper/TransportConfig.cpp
@@ -37,8 +37,8 @@ void TransportConfig_SetSwapBytes(::OpenDDS::DCPS::TransportConfig *cfg, CORBA::
cfg->swap_bytes_ = value;
}
-TimeValueWrapper TransportConfig_GetPassiveConnectDuration(::OpenDDS::DCPS::TransportConfig *cfg) {
- return cfg->passive_connect_duration_.get();
+CORBA::UInt32 TransportConfig_GetPassiveConnectDuration(::OpenDDS::DCPS::TransportConfig *cfg) {
+ return cfg->passive_connect_duration_.get().value().msec();
}
void TransportConfig_SetPassiveConnectDuration(::OpenDDS::DCPS::TransportConfig *cfg, CORBA::UInt32 value) {
diff --git a/Native/OpenDDSWrapper/TransportConfig.h b/Native/OpenDDSWrapper/TransportConfig.h
index f80b6686..7f434345 100644
--- a/Native/OpenDDSWrapper/TransportConfig.h
+++ b/Native/OpenDDSWrapper/TransportConfig.h
@@ -39,7 +39,7 @@ EXTERN_METHOD_EXPORT
void TransportConfig_SetSwapBytes(::OpenDDS::DCPS::TransportConfig *cfg, CORBA::Boolean value);
EXTERN_METHOD_EXPORT
-TimeValueWrapper TransportConfig_GetPassiveConnectDuration(::OpenDDS::DCPS::TransportConfig *cfg);
+CORBA::UInt32 TransportConfig_GetPassiveConnectDuration(::OpenDDS::DCPS::TransportConfig *cfg);
EXTERN_METHOD_EXPORT
void TransportConfig_SetPassiveConnectDuration(::OpenDDS::DCPS::TransportConfig *cfg, CORBA::UInt32 value);
diff --git a/Sources/OpenDDSharp/TimeValue.cs b/Sources/OpenDDSharp/TimeValue.cs
index a718b086..b7f98f78 100644
--- a/Sources/OpenDDSharp/TimeValue.cs
+++ b/Sources/OpenDDSharp/TimeValue.cs
@@ -19,28 +19,38 @@ You should have received a copy of the GNU Lesser General Public License
**********************************************************************/
using System;
using System.Runtime.InteropServices;
-using System.Security.Cryptography;
namespace OpenDDSharp;
///
/// Structure for time value representation.
///
-[StructLayout(LayoutKind.Explicit)]
+[StructLayout(LayoutKind.Sequential, Pack = 1)]
public struct TimeValue : IEquatable
{
+ [MarshalAs(UnmanagedType.I8)]
+ private long _seconds;
+ [MarshalAs(UnmanagedType.I4)]
+ private int _microSeconds;
+
#region Properties
///
/// Gets or sets the seconds.
///
- [field: FieldOffset(0)]
- public long Seconds { get; set; }
+ public long Seconds
+ {
+ get => _seconds;
+ set => _seconds = value;
+ }
///
/// Gets or sets the microseconds.
///
- [field: FieldOffset(8)]
- public int MicroSeconds { get; set; }
+ public int MicroSeconds
+ {
+ get => _microSeconds;
+ set => _microSeconds = value;
+ }
#endregion
#region IEquatable Members