Skip to content
This repository has been archived by the owner on Apr 27, 2023. It is now read-only.

Commit

Permalink
Merge pull request #10 from testfirstcoder/master
Browse files Browse the repository at this point in the history
Using DateTimeOffset's ToUnixTimeSeconds method
  • Loading branch information
nbarbettini committed Oct 22, 2016
2 parents abdf2f9 + a9feea9 commit 7db0165
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/SimpleTokenProvider/TokenProviderMiddleware.cs
Expand Up @@ -152,7 +152,6 @@ private static void ThrowIfInvalidOptions(TokenProviderOptions options)
/// </summary>
/// <param name="date">The date to convert.</param>
/// <returns>Seconds since Unix epoch.</returns>
public static long ToUnixEpochDate(DateTime date)
=> (long)Math.Round((date.ToUniversalTime() - new DateTimeOffset(1970, 1, 1, 0, 0, 0, TimeSpan.Zero)).TotalSeconds);
public static long ToUnixEpochDate(DateTime date) => new DateTimeOffset(date).ToUniversalTime().ToUnixTimeSeconds();
}
}
}

0 comments on commit 7db0165

Please sign in to comment.