File tree Expand file tree Collapse file tree 1 file changed +4
-3
lines changed Expand file tree Collapse file tree 1 file changed +4
-3
lines changed Original file line number Diff line number Diff line change @@ -24,6 +24,8 @@ namespace NHibernate.Id
24
24
/// </remarks>
25
25
public class GuidCombGenerator : IIdentifierGenerator
26
26
{
27
+ private static readonly long BaseDateTicks = new DateTime ( 1900 , 1 , 1 ) . Ticks ;
28
+
27
29
#region IIdentifierGenerator Members
28
30
29
31
/// <summary>
@@ -44,11 +46,10 @@ private Guid GenerateComb()
44
46
{
45
47
byte [ ] guidArray = Guid . NewGuid ( ) . ToByteArray ( ) ;
46
48
47
- DateTime baseDate = new DateTime ( 1900 , 1 , 1 ) ;
48
- DateTime now = DateTime . Now ;
49
+ DateTime now = DateTime . UtcNow ;
49
50
50
51
// Get the days and milliseconds which will be used to build the byte string
51
- TimeSpan days = new TimeSpan ( now . Ticks - baseDate . Ticks ) ;
52
+ TimeSpan days = new TimeSpan ( now . Ticks - BaseDateTicks ) ;
52
53
TimeSpan msecs = now . TimeOfDay ;
53
54
54
55
// Convert to a byte array
You can’t perform that action at this time.
0 commit comments