Skip to content

Commit

Permalink
fix: fix all Recommended level warnings in Clocks.Net
Browse files Browse the repository at this point in the history
  • Loading branch information
hcoona committed Sep 26, 2022
1 parent a66928a commit fb57768
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 17 deletions.
8 changes: 4 additions & 4 deletions Clocks.Net/Clocks.Abstraction/ILogicalClock.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@
namespace Clocks
{
/// <summary>
/// Basic interface for a logical clock
/// <para>Typical logical clocks are <strong>lamport scalar clock</strong> &amp; <strong>vector clock</strong></para>
/// Basic interface for a logical clock.
/// <para>Typical logical clocks are <strong>lamport scalar clock</strong> &amp;. <strong>vector clock</strong></para>
/// </summary>
/// <typeparam name="T">The concrete type of time point</typeparam>
/// <typeparam name="T">The concrete type of time point.</typeparam>
public interface ILogicalClock<T> : IClock<T>
where T : IComparable<T>, IEquatable<T>
{
Expand All @@ -23,7 +23,7 @@ public interface ILogicalClock<T> : IClock<T>
/// <summary>
/// Increments the internal clock and get the timepoint.
/// </summary>
/// <returns>The incremented clock timepoint</returns>
/// <returns>The incremented clock timepoint.</returns>
T IncrementAndGet();

/// <summary>
Expand Down
6 changes: 3 additions & 3 deletions Clocks.Net/Clocks.Abstraction/IPhysicalClock.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@
namespace Clocks
{
/// <summary>
/// Basic interface for a physical clock
/// <para>Physical clock could be regarded as a logical clock</para>
/// Basic interface for a physical clock.
/// <para>Physical clock could be regarded as a logical clock.</para>
/// </summary>
/// <typeparam name="T">The concrete type of time point</typeparam>
/// <typeparam name="T">The concrete type of time point.</typeparam>
/// <seealso cref="Clocks.ILogicalClock{T}" />
public interface IPhysicalClock<T> : IClock<T>
where T : IComparable<T>, IEquatable<T>
Expand Down
12 changes: 6 additions & 6 deletions Clocks.Net/Clocks.Abstraction/IStopwatchProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
namespace Clocks
{
/// <summary>
/// The factory providing <seealso cref="IStopwatch"/>
/// The factory providing. <seealso cref="IStopwatch"/>
/// </summary>
public interface IStopwatchProvider
{
Expand Down Expand Up @@ -46,12 +46,12 @@ public interface IStopwatchProvider<T> : IStopwatchProvider
T GetTimestamp();

/// <summary>
/// Parses the duration from <paramref name="from"/> to <paramref name="to"/> to a readable <seealso cref="TimeSpan"/>.
/// Parses the duration from <paramref name="fromTimestamp"/> to <paramref name="toTimestamp"/> to a readable <seealso cref="TimeSpan"/>.
/// </summary>
/// <param name="from">The starting timestamp.</param>
/// <param name="to">The ending timestamp.</param>
/// <returns>The readable <seealso cref="TimeSpan"/> representing the duration from <paramref name="from"/> to <paramref name="to"/>.</returns>
TimeSpan ParseDuration(T from, T to);
/// <param name="fromTimestamp">The starting timestamp.</param>
/// <param name="toTimestamp">The ending timestamp.</param>
/// <returns>The readable <seealso cref="TimeSpan"/> representing the duration from <paramref name="fromTimestamp"/> to <paramref name="toTimestamp"/>.</returns>
TimeSpan ParseDuration(T fromTimestamp, T toTimestamp);

/// <summary>
/// Gets the next timestamp elapsed <paramref name="interval"/> from <paramref name="from"/>.
Expand Down
4 changes: 2 additions & 2 deletions Clocks.Net/Clocks.System/SystemStopwatchProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@ public long GetTimestamp()
return Stopwatch.GetTimestamp();
}

public TimeSpan ParseDuration(long from, long to)
public TimeSpan ParseDuration(long fromTimestamp, long toTimestamp)
{
return TimeSpan.FromSeconds((to - from) / (double)Stopwatch.Frequency);
return TimeSpan.FromSeconds((toTimestamp - fromTimestamp) / (double)Stopwatch.Frequency);
}

public IStopwatch StartNew()
Expand Down
3 changes: 3 additions & 0 deletions Clocks.Net/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@

<PackageReadmeFile>README.md</PackageReadmeFile>
<PackageReleaseNotes>$([System.IO.File]::ReadAllText("$(EnlistmentRoot)/Clocks.Net/ReleaseNotes.md"))</PackageReleaseNotes>

<AnalysisMode>Recommended</AnalysisMode>
<NoWarn>NU1507</NoWarn>
</PropertyGroup>

<ItemGroup>
Expand Down
3 changes: 1 addition & 2 deletions Clocks.Net/ReleaseNotes.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@

## v1.4.1

No source code changes.

1. Support reproducible build.
2. Generate symbol package.
3. Include README.md into package.
4. Fix all Recommended level code analysis warnings.

0 comments on commit fb57768

Please sign in to comment.