We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents bcfa9b2 + 4e25c1e commit ef0788bCopy full SHA for ef0788b
src/NHibernate/Id/GuidCombGenerator.cs
@@ -24,6 +24,8 @@ namespace NHibernate.Id
24
/// </remarks>
25
public class GuidCombGenerator : IIdentifierGenerator
26
{
27
+ private static readonly long BaseDateTicks = new DateTime(1900, 1, 1).Ticks;
28
+
29
#region IIdentifierGenerator Members
30
31
/// <summary>
@@ -44,11 +46,10 @@ private Guid GenerateComb()
44
46
45
47
byte[] guidArray = Guid.NewGuid().ToByteArray();
48
- DateTime baseDate = new DateTime(1900, 1, 1);
- DateTime now = DateTime.Now;
49
+ DateTime now = DateTime.UtcNow;
50
51
// Get the days and milliseconds which will be used to build the byte string
- TimeSpan days = new TimeSpan(now.Ticks - baseDate.Ticks);
52
+ TimeSpan days = new TimeSpan(now.Ticks - BaseDateTicks);
53
TimeSpan msecs = now.TimeOfDay;
54
55
// Convert to a byte array
0 commit comments