diff --git a/crypto/src/asn1/DerGeneralizedTime.cs b/crypto/src/asn1/DerGeneralizedTime.cs
index 40ec17b2a..17c42e7cf 100644
--- a/crypto/src/asn1/DerGeneralizedTime.cs
+++ b/crypto/src/asn1/DerGeneralizedTime.cs
@@ -83,7 +83,11 @@ namespace Org.BouncyCastle.Asn1
public DerGeneralizedTime(
DateTime time)
{
+#if PORTABLE
this.time = time.ToUniversalTime().ToString(@"yyyyMMddHHmmss\Z");
+#else
+ this.time = time.ToString(@"yyyyMMddHHmmss\Z");
+#endif
}
internal DerGeneralizedTime(
diff --git a/crypto/src/asn1/DerUTCTime.cs b/crypto/src/asn1/DerUTCTime.cs
index ebf57198f..4f0792636 100644
--- a/crypto/src/asn1/DerUTCTime.cs
+++ b/crypto/src/asn1/DerUTCTime.cs
@@ -86,7 +86,11 @@ namespace Org.BouncyCastle.Asn1
public DerUtcTime(
DateTime time)
{
+#if PORTABLE
this.time = time.ToUniversalTime().ToString("yyMMddHHmmss", CultureInfo.InvariantCulture) + "Z";
+#else
+ this.time = time.ToString("yyMMddHHmmss", CultureInfo.InvariantCulture) + "Z";
+#endif
}
internal DerUtcTime(
diff --git a/crypto/src/asn1/x509/Time.cs b/crypto/src/asn1/x509/Time.cs
index 770d59d46..ffe293521 100644
--- a/crypto/src/asn1/x509/Time.cs
+++ b/crypto/src/asn1/x509/Time.cs
@@ -34,7 +34,11 @@ namespace Org.BouncyCastle.Asn1.X509
public Time(
DateTime date)
{
+#if PORTABLE
string d = date.ToUniversalTime().ToString("yyyyMMddHHmmss", CultureInfo.InvariantCulture) + "Z";
+#else
+ string d = date.ToString("yyyyMMddHHmmss", CultureInfo.InvariantCulture) + "Z";
+#endif
int year = int.Parse(d.Substring(0, 4));
diff --git a/crypto/src/util/Enums.cs b/crypto/src/util/Enums.cs
index 20b978c22..660bbe73f 100644
--- a/crypto/src/util/Enums.cs
+++ b/crypto/src/util/Enums.cs
@@ -44,13 +44,13 @@ namespace Org.BouncyCastle.Utilities
internal static Array GetEnumValues(System.Type enumType)
{
#if NEW_REFLECTION
- if(!enumType.GetTypeInfo().IsEnum)
+ if (!enumType.GetTypeInfo().IsEnum)
#else
if (!enumType.IsEnum)
#endif
throw new ArgumentException("Not an enumeration type", "enumType");
-#if NETCF_1_0 || NETCF_2_0 || SILVERLIGHT && !PORTABLE
+#if NETCF_1_0 || NETCF_2_0 || SILVERLIGHT
IList result = Platform.CreateArrayList();
FieldInfo[] fields = enumType.GetFields(BindingFlags.Static | BindingFlags.Public);
foreach (FieldInfo field in fields)
diff --git a/crypto/src/util/TypeExtensions.cs b/crypto/src/util/TypeExtensions.cs
index c7ce807a0..e2aeae4dc 100644
--- a/crypto/src/util/TypeExtensions.cs
+++ b/crypto/src/util/TypeExtensions.cs
@@ -1,8 +1,8 @@
+#if NEW_REFLECTION
+
using System;
using System.Reflection;
-#if NEW_REFLECTION
-
namespace Org.BouncyCastle
{
internal static class TypeExtensions
@@ -12,7 +12,6 @@ namespace Org.BouncyCastle
return instance != null && type.GetTypeInfo().IsAssignableFrom(instance.GetType().GetTypeInfo());
}
}
-
}
-#endif
\ No newline at end of file
+#endif
|