Hi Paul,
I have a problem with Zulu Time and Local Time :
I choose an airport on US, (KVPS for example)
Local Time = 30 may 2017 18:59:30
Zulu Time = 30 may 2017 23:59:30
and have a timer to update values each second. All is ok but when Zulu Time = 31 may 2017 00:00:01, date for Local Time is now =31 may 2017 19:00:01. For Local Time date must be 30 may and not 31 may.
Here is the code :
private Offset<byte[]> fsLocalDateTime = new Offset<byte[]>(0x0238, 10);
private Offset<byte[]> fsZuluDateTime = new Offset<byte[]>(0x023B, 10);
private Offset<byte> zmin = new Offset<byte>(0x23c);
private Offset<byte> zhour = new Offset<byte>(0x23b);
private Offset<byte> second = new Offset<byte>(0x23a);
private void timer1_Tick(object sender, EventArgs e)
{
// Process the default group
try
{
FSUIPCConnection.Process();
// get local Time
short year = BitConverter.ToInt16(fsLocalDateTime.Value, 8);
DateTime fsTime = new DateTime(year, 1, 1, fsLocalDateTime.Value[0], fsLocalDateTime.Value[1], fsLocalDateTime.Value[2]);
short dayNo = BitConverter.ToInt16(fsLocalDateTime.Value, 6);
fsTime = fsTime.Add(new TimeSpan(dayNo - 1, 0, 0, 0));
lblLocalTime.Text = (fsTime.ToString("F", CultureInfo.CreateSpecificCulture("fr-FR")));
// get Zulu Time
short year2 = BitConverter.ToInt16(fsZuluDateTime.Value, 5);
DateTime fsZuluTime = new DateTime(year2, 1, 1, zhour.Value, zmin.Value, second.Value);
short zuludayNo = BitConverter.ToInt16(fsZuluDateTime.Value, 6);
fsZuluTime = fsZuluTime.Add(new TimeSpan(dayNo - 1, 0, 0, 0));
lblZuluTime.Text = (fsZuluTime.ToString("F", CultureInfo.CreateSpecificCulture("fr-FR")));
}
catch (Exception ex)
{
MessageBox.Show("Error : " + ex.Message);
}
}
Thank you for your help.