mirror of
https://github.com/zoriya/octokit.net.git
synced 2026-06-02 19:00:47 +00:00
Unix Timestamp helper
This commit is contained in:
@@ -0,0 +1,14 @@
|
||||
using System;
|
||||
|
||||
namespace Octokit.Helpers
|
||||
{
|
||||
public static class UnixTimestampExtensions
|
||||
{
|
||||
const long _unixEpochTicks = 621355968000000000; // Unix Epoch is January 1, 1970 00:00 -0:00
|
||||
|
||||
public static DateTimeOffset FromUnixTime(this long unixTime)
|
||||
{
|
||||
return new DateTimeOffset(unixTime * TimeSpan.TicksPerSecond + _unixEpochTicks, TimeSpan.Zero);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user