diff --git a/dotnet/IEC61850forCSharp/MmsValue.cs b/dotnet/IEC61850forCSharp/MmsValue.cs
index 1a9d1b6d..8af017f8 100644
--- a/dotnet/IEC61850forCSharp/MmsValue.cs
+++ b/dotnet/IEC61850forCSharp/MmsValue.cs
@@ -103,6 +103,12 @@ namespace IEC61850
[DllImport("iec61850", CallingConvention = CallingConvention.Cdecl)]
static extern ulong MmsValue_getUtcTimeInMsWithUs(IntPtr self, [Out] uint usec);
+ [DllImport("iec61850", CallingConvention = CallingConvention.Cdecl)]
+ static extern byte MmsValue_getUtcTimeQuality (IntPtr self);
+
+ [DllImport("iec61850", CallingConvention = CallingConvention.Cdecl)]
+ static extern void MmsValue_setUtcTimeQuality (IntPtr self, byte timeQuality);
+
[DllImport("iec61850", CallingConvention = CallingConvention.Cdecl)]
static extern UInt32 MmsValue_toUnixTimestamp (IntPtr self);
@@ -467,6 +473,44 @@ namespace IEC61850
throw new MmsValueException("Value is not a time type");
}
+ ///
+ /// Gets quality flags of an UTC timestamp.
+ ///
+ ///
+ /// Meaning of the bits in the timeQuality byte:
+ /// bit 7 = leapSecondsKnown
+ /// bit 6 = clockFailure
+ /// bit 5 = clockNotSynchronized
+ /// bit 0-4 = subsecond time accuracy (number of significant bits of subsecond time)
+ ///
+ /// The UTC time quality.
+ public byte GetUtcTimeQuality()
+ {
+ if (GetType() == MmsType.MMS_UTC_TIME)
+ return MmsValue_getUtcTimeQuality(valueReference);
+ else
+ throw new MmsValueException("Value is not a time type");
+ }
+
+ ///
+ /// Sets the quality flags of an UTC timestamp
+ ///
+ ///
+ /// Meaning of the bits in the timeQuality byte:
+ /// bit 7 = leapSecondsKnown
+ /// bit 6 = clockFailure
+ /// bit 5 = clockNotSynchronized
+ /// bit 0-4 = subsecond time accuracy (number of significant bits of subsecond time)
+ ///
+ /// Time quality.
+ public void SetUtcTimeQuality(byte timeQuality)
+ {
+ if (GetType () == MmsType.MMS_UTC_TIME)
+ MmsValue_setUtcTimeQuality (valueReference, timeQuality);
+ else
+ throw new MmsValueException("Value is not a time type");
+ }
+
///
/// Convert a millisecond time (milliseconds since epoch) to DataTimeOffset
///
diff --git a/src/vs/libiec61850-wo-goose.def b/src/vs/libiec61850-wo-goose.def
index 8354e2fa..5d45282d 100644
--- a/src/vs/libiec61850-wo-goose.def
+++ b/src/vs/libiec61850-wo-goose.def
@@ -523,4 +523,5 @@ EXPORTS
MmsValue_getUtcTimeQuality
MmsConnection_getMmsConnectionParameters
IedServer_updateVisibleStringAttributeValue
+ MmsValue_setUtcTimeQuality
diff --git a/src/vs/libiec61850.def b/src/vs/libiec61850.def
index 7ad6426e..b25c2219 100644
--- a/src/vs/libiec61850.def
+++ b/src/vs/libiec61850.def
@@ -600,4 +600,5 @@ EXPORTS
MmsValue_getUtcTimeQuality
MmsConnection_getMmsConnectionParameters
IedServer_updateVisibleStringAttributeValue
+ MmsValue_setUtcTimeQuality