From 2e2901ceac1291fab8c2ed9828bceded00440a16 Mon Sep 17 00:00:00 2001 From: Peter Dettman Date: Thu, 23 Jun 2022 17:54:55 +0700 Subject: New build organization - TargetFrameworks netstandard2.0;net40 --- crypto/src/asn1/DerGeneralizedTime.cs | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) (limited to 'crypto/src/asn1') diff --git a/crypto/src/asn1/DerGeneralizedTime.cs b/crypto/src/asn1/DerGeneralizedTime.cs index 1efa792df..f5ef3f372 100644 --- a/crypto/src/asn1/DerGeneralizedTime.cs +++ b/crypto/src/asn1/DerGeneralizedTime.cs @@ -181,18 +181,7 @@ namespace Org.BouncyCastle.Asn1 char sign = '+'; DateTime time = ToDateTime(); -#if PORTABLE - long offset = time.Ticks - time.ToUniversalTime().Ticks; - if (offset < 0) - { - sign = '-'; - offset = -offset; - } - int hours = (int)(offset / TimeSpan.TicksPerHour); - int minutes = (int)(offset / TimeSpan.TicksPerMinute) % 60; -#else - // Note: GetUtcOffset incorporates Daylight Savings offset - TimeSpan offset = TimeZone.CurrentTimeZone.GetUtcOffset(time); + TimeSpan offset = TimeZoneInfo.Local.GetUtcOffset(time); if (offset.CompareTo(TimeSpan.Zero) < 0) { sign = '-'; @@ -200,7 +189,6 @@ namespace Org.BouncyCastle.Asn1 } int hours = offset.Hours; int minutes = offset.Minutes; -#endif return "GMT" + sign + Convert(hours) + ":" + Convert(minutes); } -- cgit 1.4.1