Skip to content

Commit

Permalink
Merge pull request #194 from Tronald/develop
Browse files Browse the repository at this point in the history
UTC offset extended to -12/+14
  • Loading branch information
Tronald authored Sep 27, 2021
2 parents 51a40b7 + 5daabcd commit 31132fd
Show file tree
Hide file tree
Showing 7 changed files with 32 additions and 33 deletions.
7 changes: 3 additions & 4 deletions CoordinateSharp.Magnetic/CoordinateSharp.Magnetic.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -47,22 +47,21 @@ For more information, please contact Signature Group, LLC at this address: sales
<TargetFrameworks>net40; netstandard1.3; netstandard1.4; netstandard2.0; netstandard2.1;</TargetFrameworks>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<Version>1.1.1.0</Version>
<Version>1.1.2.0</Version>
<Authors>Signature Group, LLC</Authors>
<Company />
<PackageProjectUrl>https://github.com/Tronald/CoordinateSharp</PackageProjectUrl>
<PackageLicenseUrl></PackageLicenseUrl>
<Copyright>Copyright 2021</Copyright>
<Description>CoordinateSharp magnetic data extensions.</Description>
<PackageReleaseNotes>-Updates license for clarification
</PackageReleaseNotes>
<PackageReleaseNotes>-Updated to pull latest package of CoordinateSharp</PackageReleaseNotes>
<PackageTags>CoordinateSharp Latitude Longitude Coordinates Geography Magnetic Declination</PackageTags>
<!-- <PackageLicenseExpression>AGPL-3.0-or-later</PackageLicenseExpression>-->
<PackageLicenseFile>License.txt</PackageLicenseFile>
<PackageIconUrl></PackageIconUrl>
<PackageId>CoordinateSharp.Magnetic</PackageId>
<Title>CoordinateSharp.Magnetic</Title>
<AssemblyVersion>1.1.1.0</AssemblyVersion>
<AssemblyVersion>1.1.2.0</AssemblyVersion>
<PackageRequireLicenseAcceptance>true</PackageRequireLicenseAcceptance>
<SignAssembly>true</SignAssembly>
<PackageIcon>CoordinateSharpPNG.png</PackageIcon>
Expand Down
2 changes: 1 addition & 1 deletion CoordinateSharp/Celestial/Celestial.Methods.cs
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ internal void CalculateCelestialTime(double lat, double longi, DateTime date, Ea
/// <param name="offset">UTC offset in hours</param>
internal void CalculateCelestialTime(double lat, double longi, DateTime date, EagerLoad el, double offset)
{
if (offset < -12 || offset > 12) { throw new ArgumentOutOfRangeException("Time offsets cannot be greater than 12 or less than -12."); }
if (offset < -12 || offset > 14) { throw new ArgumentOutOfRangeException("Time offsets cannot be greater than 14 or less than -12."); }

date = new DateTime(date.Year, date.Month, date.Day, date.Hour, date.Minute, date.Second, DateTimeKind.Utc);

Expand Down
6 changes: 3 additions & 3 deletions CoordinateSharp/Celestial/Celestial.StaticMethods.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1360,7 +1360,7 @@ private static int Determine_Slipped_Event_Index(DateTime? actual, DateTime? pre
[Obsolete("Use instance method 'Coordinate.Celestial_LocalTime(double hourOffset)'.")]
public static Celestial Celestial_LocalTime(Coordinate coord, double offset)
{
if (offset < -12 || offset > 12) { throw new ArgumentOutOfRangeException("Time offsets cannot be greater 12 or less than -12."); }
if (offset < -12 || offset > 14) { throw new ArgumentOutOfRangeException("Time offsets cannot be greater 14 or less than -12."); }
//Probably need to offset initial UTC date so user can op in local
//Determine best way to do this.
DateTime d = coord.GeoDate.AddHours(offset);
Expand Down Expand Up @@ -1447,7 +1447,7 @@ public static Celestial Celestial_LocalTime(Coordinate coord, double offset)
[Obsolete("Use instance method 'Coordinate.Celestial_LocalTime(double hourOffset)'.")]
public static Celestial Solar_LocalTime(Coordinate coord, double offset)
{
if (offset < -12 || offset > 12) { throw new ArgumentOutOfRangeException("Time offsets cannot be greater 12 or less than -12."); }
if (offset < -12 || offset > 14) { throw new ArgumentOutOfRangeException("Time offsets cannot be greater 14 or less than -12."); }
//Probably need to offset initial UTC date so user can op in local
//Determine best way to do this.
DateTime d = coord.GeoDate.AddHours(offset);
Expand Down Expand Up @@ -1522,7 +1522,7 @@ public static Celestial Solar_LocalTime(Coordinate coord, double offset)
[Obsolete("Use instance method 'Coordinate.Celestial_LocalTime(double hourOffset)'.")]
public static Celestial Lunar_LocalTime(Coordinate coord, double offset)
{
if (offset < -12 || offset > 12) { throw new ArgumentOutOfRangeException("Time offsets cannot be greater 12 or less than -12."); }
if (offset < -12 || offset > 14) { throw new ArgumentOutOfRangeException("Time offsets cannot be greater 14 or less than -12."); }
//Probably need to offset initial UTC date so user can op in local
//Determine best way to do this.
DateTime d = coord.GeoDate.AddHours(offset);
Expand Down
4 changes: 2 additions & 2 deletions CoordinateSharp/Coordinate/Coordinate.Model.cs
Original file line number Diff line number Diff line change
Expand Up @@ -180,8 +180,8 @@ public double Offset
{
if (offset != value)
{
if (value < -12 || value > 12)
{ throw new ArgumentOutOfRangeException("Time offsets cannot be greater than 12 or less than -12."); }
if (value < -12 || value > 14)
{ throw new ArgumentOutOfRangeException("Time offsets cannot be greater than 14 or less than -12."); }

offset = value;

Expand Down
10 changes: 5 additions & 5 deletions CoordinateSharp/CoordinateSharp.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -47,28 +47,28 @@ For more information, please contact Signature Group, LLC at this address: sales
<TargetFrameworks>net40; netstandard1.3; netstandard1.4; netstandard2.0; netstandard2.1;</TargetFrameworks>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<Version>2.11.1.1</Version>
<Version>2.12.1.1</Version>
<Authors>Signature Group, LLC</Authors>
<Company />
<PackageProjectUrl>https://github.com/Tronald/CoordinateSharp</PackageProjectUrl>
<PackageLicenseUrl></PackageLicenseUrl>
<Copyright>Copyright 2021</Copyright>
<Description>A simple library designed to assist with geographic coordinate conversions, formatting and location based solar and lunar information.</Description>
<PackageReleaseNotes>-Updates license for clarification.
-Documentation fixes.
<PackageReleaseNotes>-Extends UTC offset validation from -12/+12 to -12/+14 to handle outlying countries that extend IDL past 12 hours.
</PackageReleaseNotes>
<PackageTags>CoordinateSharp Latitude Longitude Coordinates Geography Sun Moon Solar Lunar Time MGRS UTM Julian ECEF Sunset Sunrise Set Moonset Moonrise</PackageTags>
<!-- <PackageLicenseExpression>AGPL-3.0-or-later</PackageLicenseExpression>-->
<PackageLicenseFile>License.txt</PackageLicenseFile> <PackageIconUrl></PackageIconUrl>
<PackageId>CoordinateSharp</PackageId>
<Title>CoordinateSharp</Title>
<AssemblyVersion>2.11.1.1</AssemblyVersion>
<AssemblyVersion>2.12.1.1</AssemblyVersion>
<PackageRequireLicenseAcceptance>true</PackageRequireLicenseAcceptance>
<SignAssembly>true</SignAssembly>
<PackageIcon>CoordinateSharpPNG.png</PackageIcon>
<AssemblyOriginatorKeyFile>CoordinateSharp Strong Name.snk</AssemblyOriginatorKeyFile>
<DelaySign>false</DelaySign>
<FileVersion>2.11.1.1</FileVersion>
<FileVersion>2.12.1.1</FileVersion>
<RepositoryUrl>https://github.com/Tronald/CoordinateSharp</RepositoryUrl>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Release|net40|AnyCPU'">
Expand Down
18 changes: 9 additions & 9 deletions CoordinateSharp_UnitTests/Celestial.Lunar.cs
Original file line number Diff line number Diff line change
Expand Up @@ -315,25 +315,25 @@ public void Local_Time()
cUTC.Offset = -12;
cUTC.Offset = 12;
cCel = new Celestial(0, 0, DateTime.Now, -12);
cCel = new Celestial(0, 0, DateTime.Now, 12);
cCel = new Celestial(0, 0, DateTime.Now, 14);
cCel = new Celestial(0, 0, DateTime.Now, -12, new EagerLoad());
cCel = new Celestial(0, 0, DateTime.Now, 12, new EagerLoad());
cCel = new Celestial(0, 0, DateTime.Now, 14, new EagerLoad());
cCel = Celestial.CalculateCelestialTimes(0, 0, DateTime.Now, -12);
cCel = Celestial.CalculateCelestialTimes(0, 0, DateTime.Now, 12);
cCel = Celestial.CalculateCelestialTimes(0, 0, DateTime.Now, new EagerLoad(), 12);
cCel = Celestial.CalculateCelestialTimes(0, 0, DateTime.Now, 14);
cCel = Celestial.CalculateCelestialTimes(0, 0, DateTime.Now, new EagerLoad(), 14);
cCel = Celestial.CalculateCelestialTimes(0, 0, DateTime.Now, new EagerLoad(), -12);

//OUT OF RANGE
Assert.ThrowsException<ArgumentOutOfRangeException>(() => { cUTC.Offset = -13; });
Assert.ThrowsException<ArgumentOutOfRangeException>(() => { cUTC.Offset = 13; });
Assert.ThrowsException<ArgumentOutOfRangeException>(() => { cUTC.Offset = 15; });
Assert.ThrowsException<ArgumentOutOfRangeException>(() => { cCel = new Celestial(0, 0, DateTime.Now, -13); });
Assert.ThrowsException<ArgumentOutOfRangeException>(() => { cCel = new Celestial(0, 0, DateTime.Now, 13); });
Assert.ThrowsException<ArgumentOutOfRangeException>(() => { cCel = new Celestial(0, 0, DateTime.Now, 15); });
Assert.ThrowsException<ArgumentOutOfRangeException>(() => { cCel = new Celestial(0, 0, DateTime.Now, -13, new EagerLoad()); });
Assert.ThrowsException<ArgumentOutOfRangeException>(() => { cCel = new Celestial(0, 0, DateTime.Now, 13, new EagerLoad()); });
Assert.ThrowsException<ArgumentOutOfRangeException>(() => { cCel = new Celestial(0, 0, DateTime.Now, 15, new EagerLoad()); });
Assert.ThrowsException<ArgumentOutOfRangeException>(() => { cCel = Celestial.CalculateCelestialTimes(0, 0, DateTime.Now, -13); });
Assert.ThrowsException<ArgumentOutOfRangeException>(() => { cCel = Celestial.CalculateCelestialTimes(0, 0, DateTime.Now, 13); });
Assert.ThrowsException<ArgumentOutOfRangeException>(() => { cCel = Celestial.CalculateCelestialTimes(0, 0, DateTime.Now, 15); });
Assert.ThrowsException<ArgumentOutOfRangeException>(() => { cCel = Celestial.CalculateCelestialTimes(0, 0, DateTime.Now, new EagerLoad(), -13); });
Assert.ThrowsException<ArgumentOutOfRangeException>(() => { cCel = Celestial.CalculateCelestialTimes(0, 0, DateTime.Now, new EagerLoad(), 13); });
Assert.ThrowsException<ArgumentOutOfRangeException>(() => { cCel = Celestial.CalculateCelestialTimes(0, 0, DateTime.Now, new EagerLoad(), 15); });

}

Expand Down
18 changes: 9 additions & 9 deletions CoordinateSharp_UnitTests/Celestial.Solar.cs
Original file line number Diff line number Diff line change
Expand Up @@ -378,24 +378,24 @@ public void Local_Time()
cUTC.Offset = -12;
cUTC.Offset = 12;
cCel = new Celestial(0, 0, DateTime.Now, -12);
cCel = new Celestial(0, 0, DateTime.Now, 12);
cCel = new Celestial(0, 0, DateTime.Now, 14);
cCel = new Celestial(0, 0, DateTime.Now, -12, new EagerLoad());
cCel = new Celestial(0, 0, DateTime.Now, 12, new EagerLoad());
cCel = new Celestial(0, 0, DateTime.Now, 14, new EagerLoad());
cCel = Celestial.CalculateCelestialTimes(0, 0, DateTime.Now, -12);
cCel = Celestial.CalculateCelestialTimes(0, 0, DateTime.Now, 12);
cCel = Celestial.CalculateCelestialTimes(0, 0, DateTime.Now, new EagerLoad(), 12);
cCel = Celestial.CalculateCelestialTimes(0, 0, DateTime.Now, 14);
cCel = Celestial.CalculateCelestialTimes(0, 0, DateTime.Now, new EagerLoad(), 14);
cCel = Celestial.CalculateCelestialTimes(0, 0, DateTime.Now, new EagerLoad(), -12);
//OUT OF RANGE
Assert.ThrowsException<ArgumentOutOfRangeException>(() => { cUTC.Offset = -13; });
Assert.ThrowsException<ArgumentOutOfRangeException>(() => { cUTC.Offset = 13; });
Assert.ThrowsException<ArgumentOutOfRangeException>(() => { cUTC.Offset = 15; });
Assert.ThrowsException<ArgumentOutOfRangeException>(() => { cCel = new Celestial(0, 0, DateTime.Now, -13); });
Assert.ThrowsException<ArgumentOutOfRangeException>(() => { cCel = new Celestial(0, 0, DateTime.Now, 13); });
Assert.ThrowsException<ArgumentOutOfRangeException>(() => { cCel = new Celestial(0, 0, DateTime.Now, 15); });
Assert.ThrowsException<ArgumentOutOfRangeException>(() => { cCel = new Celestial(0, 0, DateTime.Now, -13, new EagerLoad()); });
Assert.ThrowsException<ArgumentOutOfRangeException>(() => { cCel = new Celestial(0, 0, DateTime.Now, 13, new EagerLoad()); });
Assert.ThrowsException<ArgumentOutOfRangeException>(() => { cCel = new Celestial(0, 0, DateTime.Now, 15, new EagerLoad()); });
Assert.ThrowsException<ArgumentOutOfRangeException>(() => { cCel = Celestial.CalculateCelestialTimes(0, 0, DateTime.Now, -13); });
Assert.ThrowsException<ArgumentOutOfRangeException>(() => { cCel = Celestial.CalculateCelestialTimes(0, 0, DateTime.Now, 13); });
Assert.ThrowsException<ArgumentOutOfRangeException>(() => { cCel = Celestial.CalculateCelestialTimes(0, 0, DateTime.Now, 15); });
Assert.ThrowsException<ArgumentOutOfRangeException>(() => { cCel = Celestial.CalculateCelestialTimes(0, 0, DateTime.Now, new EagerLoad(), -13); });
Assert.ThrowsException<ArgumentOutOfRangeException>(() => { cCel = Celestial.CalculateCelestialTimes(0, 0, DateTime.Now, new EagerLoad(), 13); });
Assert.ThrowsException<ArgumentOutOfRangeException>(() => { cCel = Celestial.CalculateCelestialTimes(0, 0, DateTime.Now, new EagerLoad(), 15); });

}

Expand Down

0 comments on commit 31132fd

Please sign in to comment.