Epoch.net
4.1.0
dotnet add package Epoch.net --version 4.1.0
NuGet\Install-Package Epoch.net -Version 4.1.0
<PackageReference Include="Epoch.net" Version="4.1.0" />
paket add Epoch.net --version 4.1.0
#r "nuget: Epoch.net, 4.1.0"
// Install Epoch.net as a Cake Addin #addin nuget:?package=Epoch.net&version=4.1.0 // Install Epoch.net as a Cake Tool #tool nuget:?package=Epoch.net&version=4.1.0
๐ Introduction
A simple and non-intrusive library for all your epoch needs
using Epoch.net;
...
var timestamp = EpochTime.Now;
...
๐ค What is an Epoch
Epoch is shorthand for Unix epoch time or as it is also known POSIX time.
Short version: The number of seconds since 1970-01-01T00:00:00Z without leap seconds.
Long version: unix time
Motivation
With .net core working on all major operating systems and most of them using POSIX to denote time and timestamps. Not to mention the myriad of 3rd party tools, using POSIX time internally. The need for a working and tested implementation became clearer and clearer. Additionally I did not want to write this logic in an inferior form in many of my applications. So this little library was written.
Its sole purpose is to make the work with these unix timestamps as easy as possible.
For this purpose this library contains extension methods that build upon the existing DateTime, TimeSpan, int and long types.
๐ Glossary
Term | Description |
---|---|
EpochTime | Represents a POSIX time instance exact to the second |
EpochTimestamp | The number of seconds since 1970-01-01T00:00Z |
LongEpochTime | Represents a POSIX time instance exact to the millisecond |
LongEpochTimestamp | The number of milliseconds since 1970-01-01T00:00Z |
Difference between EpochTime
and LongEpochTime
The initial difference was precision. EpochTime will only be accurate to the nearest second on the other hand LongEpochTime is accurate to the millisecond. From this precision difference I decided to differentiate then by their underlying base type.
EpochTime
is based on int32
/ int
LongEpochTime
is based on int64
/ long
โThis is sadly implies that if you get a POSIX timestamp from somewhere you, the developer, have to know if it is representing milliseconds or seconds!
Ranges
Unit | Min value | Max value |
---|---|---|
EpochTimestamp | -2147483648 | 2147483647 |
LongEpochTimestamp | -922337203685477 | 922337203685477 |
๐ Note: The range of the LongEpoch
is theoretically limited only by the range of int64
.
โ Features
- EpochTime a second precise POSIX time wrapper
- LongEpochTime a millisecond precise POSIX time wrapper
- Extension methods for build in time handling classes:
- DateTime
- TimeSpan
- DateOnly
- TimeOnly
- Fully tested ๐
๐โโ๏ธ Quick start
Add the package to yor project
The preferred way of integrating the library is to use the nuget package. This is easily done be either:
dotnet add package Epoch.net
or
Install-Package Epoch.net
Reference
After the package is added to the project add the using directive:
...
using Epoch.net;
...
Done ๐
๐ฆฎ Helping out
Everyone can help in their own way.
Here are just some ideas:
- Create a ticket with a improvement suggestion
- Create a ticket with a bug or issue you may be having
- Create a ticket with a question that you may be having
- Have a look at the code and suggest improvements
- Spread the word of its existence
- And for the hardcore among you you can help me with the documentation ๐
๐ Links
โญ๏ธ Next steps
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 is compatible. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
.NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
.NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 is compatible. net481 was computed. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen40 was computed. tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETFramework 4.8
- No dependencies.
-
.NETStandard 2.0
- No dependencies.
-
net6.0
- No dependencies.
-
net7.0
- No dependencies.
-
net8.0
- No dependencies.
NuGet packages (6)
Showing the top 5 NuGet packages that depend on Epoch.net:
Package | Downloads |
---|---|
Vonage
Official C#/.NET wrapper for the Vonage API. To use it you will need a Vonage account. Sign up for free at vonage.com. For full API documentation refer to developer.vonage.com. |
|
Vonage.Signed
Official C#/.NET wrapper for the Vonage API. To use it you will need a Vonage account. Sign up for free at vonage.com. For full API documentation refer to developer.vonage.com. |
|
openTSDB.net
Implements a simple facade to store data into a OpenTSDB database |
|
MVCEnabledPINGIntegrator
My package description. |
|
QuickNV.YS7
่ค็ณๅ่ฎฎ |
GitHub repositories (1)
Showing the top 1 popular GitHub repositories that depend on Epoch.net:
Repository | Stars |
---|---|
Vonage/vonage-dotnet-sdk
Vonage REST API client for .NET, written in C#. API support for SMS, Voice, Text-to-Speech, Numbers, Verify (2FA) and more.
|
Version | Downloads | Last updated |
---|---|---|
4.1.0 | 82,707 | 1/24/2024 |
4.0.0 | 147,289 | 11/12/2023 |
3.0.41 | 238,403 | 7/16/2019 |
2.0.29 | 1,680 | 6/27/2019 |
1.1.24 | 1,622 | 1/23/2019 |
1.0.21 | 1,199 | 1/20/2019 |
1.0.19 | 1,285 | 1/20/2019 |
1.0.18-master | 1,126 | 1/20/2019 |
0.9.11-net-stadard | 1,143 | 12/27/2018 |
0.9.10-net-stadard | 1,041 | 12/24/2018 |
0.1.5 | 2,547 | 6/2/2017 |
0.1.4 | 1,798 | 5/17/2017 |
CHANGELOG.md