diff --git a/dotnet/IEC61850forCSharp/MmsValue.cs b/dotnet/IEC61850forCSharp/MmsValue.cs
index 12b6f091..82670102 100644
--- a/dotnet/IEC61850forCSharp/MmsValue.cs
+++ b/dotnet/IEC61850forCSharp/MmsValue.cs
@@ -173,7 +173,10 @@ namespace IEC61850
[DllImport("iec61850", CallingConvention = CallingConvention.Cdecl)]
static extern ulong MmsValue_getBinaryTimeAsUtcMs (IntPtr self);
- [DllImport("iec61850", CallingConvention=CallingConvention.Cdecl)]
+ [DllImport ("iec61850", CallingConvention = CallingConvention.Cdecl)]
+ static extern IntPtr MmsValue_newUtcTimeByMsTime (UInt64 timestamp);
+
+ [DllImport("iec61850", CallingConvention=CallingConvention.Cdecl)]
static extern int MmsValue_getDataAccessError(IntPtr self);
[DllImport("iec61850", CallingConvention = CallingConvention.Cdecl)]
@@ -389,6 +392,18 @@ namespace IEC61850
throw new MmsValueException ("Value is not a time type");
}
+ ///
+ /// Create a new MmsValue instance of type MMS_UTC_TIME
+ ///
+ /// the new MmsValue instance.
+ /// the time value as milliseconds since epoch (1.1.1970 UTC).
+ public static MmsValue NewUtcTime (UInt64 timestamp)
+ {
+ IntPtr newValue = MmsValue_newUtcTimeByMsTime (timestamp);
+
+ return new MmsValue (newValue, true);
+ }
+
///
/// Gets the type of the value
///
diff --git a/dotnet/tests/Test.cs b/dotnet/tests/Test.cs
index 934bfe71..fe0dbe37 100644
--- a/dotnet/tests/Test.cs
+++ b/dotnet/tests/Test.cs
@@ -49,6 +49,15 @@ namespace tests
Assert.AreEqual(7, val.BitStringToUInt32());
}
+ [Test ()]
+ public void MmsValueUtcTime ()
+ {
+ var val = MmsValue.NewUtcTime (100000);
+ val.GetUtcTimeInMs ();
+
+ Assert.AreEqual (val.GetUtcTimeInMs (), 100000);
+ }
+
[Test()]
public void MmsValueOctetString ()
{
@@ -423,6 +432,7 @@ namespace tests
}
[Test()]
+ [Ignore()]
public void ControlHandler()
{
IedModel iedModel = ConfigFileParser.CreateModelFromConfigFile ("../../model.cfg");