|
|
|
@ -349,6 +349,9 @@ namespace IEC61850
|
|
|
|
|
[DllImport("iec61850", CallingConvention = CallingConvention.Cdecl)]
|
|
|
|
|
static extern IntPtr Timestamp_create ();
|
|
|
|
|
|
|
|
|
|
[DllImport("iec61850", CallingConvention = CallingConvention.Cdecl)]
|
|
|
|
|
static extern IntPtr Timestamp_createFromByteArray(byte[] byteArry);
|
|
|
|
|
|
|
|
|
|
[DllImport("iec61850", CallingConvention = CallingConvention.Cdecl)]
|
|
|
|
|
static extern void Timestamp_destroy (IntPtr self);
|
|
|
|
|
|
|
|
|
@ -399,12 +402,12 @@ namespace IEC61850
|
|
|
|
|
static extern void Timestamp_setByMmsUtcTime (IntPtr self, IntPtr mmsValue);
|
|
|
|
|
|
|
|
|
|
internal IntPtr timestampRef = IntPtr.Zero;
|
|
|
|
|
private bool responsableForDeletion;
|
|
|
|
|
private bool responsibleForDeletion;
|
|
|
|
|
|
|
|
|
|
internal Timestamp(IntPtr timestampRef, bool selfAllocated)
|
|
|
|
|
{
|
|
|
|
|
this.timestampRef = timestampRef;
|
|
|
|
|
this.responsableForDeletion = selfAllocated;
|
|
|
|
|
this.responsibleForDeletion = selfAllocated;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public Timestamp (DateTime timestamp) : this ()
|
|
|
|
@ -421,12 +424,18 @@ namespace IEC61850
|
|
|
|
|
{
|
|
|
|
|
timestampRef = Timestamp_create ();
|
|
|
|
|
LeapSecondKnown = true;
|
|
|
|
|
responsableForDeletion = true;
|
|
|
|
|
responsibleForDeletion = true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public Timestamp(byte[] value)
|
|
|
|
|
{
|
|
|
|
|
timestampRef = Timestamp_createFromByteArray (value);
|
|
|
|
|
responsibleForDeletion = true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
~Timestamp ()
|
|
|
|
|
{
|
|
|
|
|
if (responsableForDeletion)
|
|
|
|
|
if (responsibleForDeletion)
|
|
|
|
|
Timestamp_destroy (timestampRef);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -536,6 +545,15 @@ namespace IEC61850
|
|
|
|
|
Timestamp_setByMmsUtcTime (timestampRef, mmsValue.valueReference);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public DateTime AsDateTime()
|
|
|
|
|
{
|
|
|
|
|
DateTime epoch = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc);
|
|
|
|
|
|
|
|
|
|
DateTime retVal = epoch.AddMilliseconds ((double) GetTimeInMilliseconds ());
|
|
|
|
|
|
|
|
|
|
return retVal;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public enum ACSIClass
|
|
|
|
|