Skip to content

Commit

Permalink
Merge pull request #18 from cpsusie/issue_17_main
Browse files Browse the repository at this point in the history
Resolve Issue #17
  • Loading branch information
cpsusie authored Aug 21, 2021
2 parents 93fa052 + 6ff08f7 commit c39fa9e
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 20 deletions.
31 changes: 18 additions & 13 deletions High Precision Time Stamps.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,29 +6,34 @@
<AssemblyName>HighPrecisionTimeStamps</AssemblyName>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<PackageRequireLicenseAcceptance>true</PackageRequireLicenseAcceptance>
<ContinuousIntegrationBuild>true</ContinuousIntegrationBuild>
<Authors>Christopher P. Susie</Authors>
<Company>CJM Screws, LLC</Company>
<Version>1.0.0.0</Version>
<Version>1.0.0.1</Version>
<Description>It is well known that DateTime.Now is often used inappropriately. For example, it may be used together with TimeSpan to produce a task's timeout point or subtracted from another DateTime to calculate a duration. This can cause subtle bugs because DateTime is not monotonic: the system clock can change, making the result of the subtraction inaccurate -- potentially causing a premature timeout or an infinite loop. Yet, DateTime is an incredibly convenient and widely used value type in .NET code and is especially useful when printed in ISO-8601 format (with the "O" format specifier).

With the "O" specifier, you can resolution down to tenths of a microsecond, which is nice. Until you learn that the resolution of the system clock is usually more coarse than several *milliseconds*, making the additional decimal places misleading garbage values. For calculating durations (time between events), it is better to use a high-resolution and monotonic clock like that provided by System.Diagnostics.Stopwatch: on most computers it is far more **accurate** than DateTime.Now even though, seemingly paradoxically, on a few systems, its *resolution* is lower than that of DateTime. Also, unsurprisingly, Stopwatch does not provide values that correlate to times of day: while it is appropriate for calculating durations, it is inappropriate for timestamping against a readable date and time.

This library provides timestamps (both as DateTime and as analogous value types it defines) that use the Stopwatch (and your system's high peformance event counter) as its clock, but returns values as DateTimes or an analog thereto so that these values can be used for a mixed purpose of timestamping and providing a meaningful way to calculate time elapsed between events or to calculate how long to perform a programmatic task.</Description>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<PackageReleaseNotes>This is the non-beta release of the fix introduced with beta version 0.1.1.0-beta. The issues resolved by that release included problems with serialization and deserialization of portable monotonic stamps when serialized on a system with a different DateTime.MinValue.ToUniversalTime() value than the one on which it is deserialized. Those changes are discussed in pull request 14 [1], issue 12 [2] and issue 13 [3]. The changes to the code can be reviewed in pull request 14 [1], commit x [5] and, most particularly around these lines of code [6].
<PackageReleaseNotes>
Release version 1.0.0.1
This release contains no changes to the code itself or to program behavior. Instead it merely fixes the repository url to refer to the source repository rather than the http page that hosts the Github repository. Also, it enables the nuget package to be built deterministically.
Release version 1.0
This is the non-beta release of the fix introduced with beta version 0.1.1.0-beta. The issues resolved by that release included problems with serialization and deserialization of portable monotonic stamps when serialized on a system with a different DateTime.MinValue.ToUniversalTime() value than the one on which it is deserialized. Those changes are discussed in pull request 14 [1], issue 12 [2] and issue 13 [3]. The changes to the code can be reviewed in pull request 14 [1], commit x [5] and, most particularly around these lines of code [6].

[1]: https://github.com/cpsusie/High-Precision-Time-Stamps/pull/14
[2]: https://github.com/cpsusie/High-Precision-Time-Stamps/issues/12
[3]: https://github.com/cpsusie/High-Precision-Time-Stamps/issues/13
[4]: https://github.com/cpsusie/High-Precision-Time-Stamps/pull/14
[5]: https://github.com/cpsusie/High-Precision-Time-Stamps/commit/01670d88755a4775100f7dd9d09eef61e0775555
[6]: https://github.com/cpsusie/High-Precision-Time-Stamps/blob/01670d88755a4775100f7dd9d09eef61e0775555/PortableMonotonicStamp.cs#L540
</PackageReleaseNotes>
<RepositoryUrl>https://github.com/cpsusie/High-Precision-Time-Stamps</RepositoryUrl>
<RepositoryType>Github</RepositoryType>
[1]: https://github.com/cpsusie/High-Precision-Time-Stamps/pull/14
[2]: https://github.com/cpsusie/High-Precision-Time-Stamps/issues/12
[3]: https://github.com/cpsusie/High-Precision-Time-Stamps/issues/13
[4]: https://github.com/cpsusie/High-Precision-Time-Stamps/pull/14
[5]: https://github.com/cpsusie/High-Precision-Time-Stamps/commit/01670d88755a4775100f7dd9d09eef61e0775555
[6]: https://github.com/cpsusie/High-Precision-Time-Stamps/blob/01670d88755a4775100f7dd9d09eef61e0775555/PortableMonotonicStamp.cs#L540
</PackageReleaseNotes>
<RepositoryUrl>https://github.com/cpsusie/High-Precision-Time-Stamps.git</RepositoryUrl>
<RepositoryType>git</RepositoryType>
<PackageTags>Timestamps DateTime Duration Monotonic-Clock TimeSpan High-Resolution ISO-8601</PackageTags>
<AssemblyVersion>1.0.0.0</AssemblyVersion>
<FileVersion>1.0.0.0</FileVersion>
<AssemblyVersion>1.0.0.1</AssemblyVersion>
<FileVersion>1.0.0.1</FileVersion>
<Copyright>Copyright (c) 2020-2021 CJM Screws, LLC</Copyright>
<PublishRepositoryUrl>true</PublishRepositoryUrl>
<EmbedUntrackedSources>true</EmbedUntrackedSources>
Expand Down
3 changes: 3 additions & 0 deletions Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -459,6 +459,9 @@ I have used this library to good effect in many projects, even closed-source pro
4. An Amazon WorkSpaces Window Server (Windows 10 based Windows server) with (most vexingly) a stopwatch frequency of 2,441,366 ticks per second.

### Release Notes
#### Version 1.0.0.1:
This release contains no changes to the code itself or to program behavior. Instead it merely fixes the repository url to refer to the source repository rather than the http page that hosts the Github repository. Also, it enables the nuget package to be built deterministically.

#### Version 1.0.0.0:
This is the non-beta release of the fix introduced with beta version 0.1.1.0-beta. The issues resolved by that release included problems with serialization and deserialization of portable monotonic stamps when serialized on a system with a different DateTime.MinValue.ToUniversalTime() value than the one on which it is deserialized. Those changes are discussed in [pull request 14][1], [issue 12][2] and [issue 13][3]. The changes to the code can be reviewed in [pull request 14][1], [commit x][5] and, most particularly around [these lines of code][6].

Expand Down
17 changes: 10 additions & 7 deletions Release.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
This is the non-beta release of the fix introduced with beta version 0.1.1.0-beta. The issues resolved by that release included problems with serialization and deserialization of portable monotonic stamps when serialized on a system with a different DateTime.MinValue.ToUniversalTime() value than the one on which it is deserialized. Those changes are discussed in pull request 14 [1], issue 12 [2] and issue 13 [3]. The changes to the code can be reviewed in pull request 14 [1], commit x [5] and, most particularly around these lines of code [6].
Release version 1.0.0.1
This release contains no changes to the code itself or to program behavior. Instead it merely fixes the repository url to refer to the source repository rather than the http page that hosts the Github repository. Also, it enables the nuget package to be built deterministically.
Release version 1.0
This is the non-beta release of the fix introduced with beta version 0.1.1.0-beta. The issues resolved by that release included problems with serialization and deserialization of portable monotonic stamps when serialized on a system with a different DateTime.MinValue.ToUniversalTime() value than the one on which it is deserialized. Those changes are discussed in pull request 14 [1], issue 12 [2] and issue 13 [3]. The changes to the code can be reviewed in pull request 14 [1], commit x [5] and, most particularly around these lines of code [6].

[1]: https://github.com/cpsusie/High-Precision-Time-Stamps/pull/14
[2]: https://github.com/cpsusie/High-Precision-Time-Stamps/issues/12
[3]: https://github.com/cpsusie/High-Precision-Time-Stamps/issues/13
[4]: https://github.com/cpsusie/High-Precision-Time-Stamps/pull/14
[5]: https://github.com/cpsusie/High-Precision-Time-Stamps/commit/01670d88755a4775100f7dd9d09eef61e0775555
[6]: https://github.com/cpsusie/High-Precision-Time-Stamps/blob/01670d88755a4775100f7dd9d09eef61e0775555/PortableMonotonicStamp.cs#L540
[1]: https://github.com/cpsusie/High-Precision-Time-Stamps/pull/14
[2]: https://github.com/cpsusie/High-Precision-Time-Stamps/issues/12
[3]: https://github.com/cpsusie/High-Precision-Time-Stamps/issues/13
[4]: https://github.com/cpsusie/High-Precision-Time-Stamps/pull/14
[5]: https://github.com/cpsusie/High-Precision-Time-Stamps/commit/01670d88755a4775100f7dd9d09eef61e0775555
[6]: https://github.com/cpsusie/High-Precision-Time-Stamps/blob/01670d88755a4775100f7dd9d09eef61e0775555/PortableMonotonicStamp.cs#L540

0 comments on commit c39fa9e

Please sign in to comment.