diff --git a/AIS/bsmd.AIS2Service/AIS_BaseStationReport.cs b/AIS/bsmd.AIS2Service/AIS_BaseStationReport.cs index 5025bfdf..432feb26 100644 --- a/AIS/bsmd.AIS2Service/AIS_BaseStationReport.cs +++ b/AIS/bsmd.AIS2Service/AIS_BaseStationReport.cs @@ -65,12 +65,19 @@ namespace bsmd.AIS2Service _repeatIndicator = GetUInt(bits, 6, 7); _mmsi = GetInt(bits, 8, 37); year = GetUInt(bits, 38, 51); - month = GetUInt(bits, 52, 55); - day = GetUInt(bits, 56, 60); - hour = GetUInt(bits, 61, 65); - minute = GetUInt(bits, 66, 71); - second = GetUInt(bits, 72, 77); - _utcTimestamp = new DateTime((int) year, (int) month, (int) day, (int) hour, (int) minute, (int) second, DateTimeKind.Utc); + if (year != 0) // year = 0 -> N/A + { + if (year > DateTime.UtcNow.Year || year < DateTime.UtcNow.Year) // liar + { + return Status.PARSE_ERROR; + } + month = GetUInt(bits, 52, 55); + day = GetUInt(bits, 56, 60); + hour = GetUInt(bits, 61, 65); + minute = GetUInt(bits, 66, 71); + second = GetUInt(bits, 72, 77); + _utcTimestamp = new DateTime((int)year, (int)month, (int)day, (int)hour, (int)minute, (int)second, DateTimeKind.Utc); + } _accuracy = GetInt(bits, 78, 78) == 1; _longitude = GetInt(bits, 79, 106); _latitude = GetInt(bits, 107, 133); diff --git a/AIS/bsmd.AIS2Service/Program.cs b/AIS/bsmd.AIS2Service/Program.cs index 581fea4a..a6b67bd8 100644 --- a/AIS/bsmd.AIS2Service/Program.cs +++ b/AIS/bsmd.AIS2Service/Program.cs @@ -17,7 +17,7 @@ namespace bsmd.AIS2Service { AISManager.Start(); // TODO wait some - Thread.Sleep(180000); + Thread.Sleep(720000); // Test finish.. AISManager.Stop(); } diff --git a/AIS/bsmd.AIS2Service/index.html b/AIS/bsmd.AIS2Service/index.html index 75abb240..839cef00 100644 --- a/AIS/bsmd.AIS2Service/index.html +++ b/AIS/bsmd.AIS2Service/index.html @@ -4,7 +4,7 @@ -