Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

GenerateTimeBasedGuid with DateTimePrecise #30

Merged
merged 1 commit into from

2 participants

@Caldas

Implemented DateTimePrecise.

@nberardi nberardi was assigned
@nberardi
Owner

This is related to issue #28

@Caldas
@nberardi nberardi referenced this pull request from a commit
Commit has since been removed from the repository and is no longer available.
@nberardi nberardi merged commit ee8650a into fluentcassandra:master
@nberardi nberardi referenced this pull request from a commit
@nberardi nberardi moved around some code from issues #28 and #30 and used DateTimePreci…
…se in other locations in the project

moved around some methods because they were on the wrong object
f4b065b
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
View
248 FluentCassandra.sln
@@ -1,124 +1,124 @@
-
-Microsoft Visual Studio Solution File, Format Version 11.00
-# Visual Studio 2010
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FluentCassandra", "src\FluentCassandra.csproj", "{EAA32600-3C2A-4B34-B9B2-5764F280FCE3}"
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FluentCassandra.Sandbox", "test\FluentCassandra.Sandbox\FluentCassandra.Sandbox.csproj", "{DE6B46DE-C37A-49AF-8B9A-B9B6D4F03A55}"
-EndProject
-Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{53AE6E93-92B4-4D33-9BE5-3CE59C1A2AD6}"
- ProjectSection(SolutionItems) = preProject
- FluentCassandra.msbuild = FluentCassandra.msbuild
- EndProjectSection
-EndProject
-Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".nuget", ".nuget", "{BF5D399F-A637-4DE2-980F-1CF057A6953C}"
- ProjectSection(SolutionItems) = preProject
- .nuget\NuGet.exe = .nuget\NuGet.exe
- .nuget\NuGet.targets = .nuget\NuGet.targets
- EndProjectSection
-EndProject
-Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Tests", "Tests", "{1A88B962-9A09-4692-80D3-E88712A9E516}"
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FluentCassandra.StressTest", "test\FluentCassandra.StressTest\FluentCassandra.StressTest.csproj", "{AC3818E2-E260-4193-A3D1-6E3FF87383F6}"
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FluentCassandra.Tests", "test\FluentCassandra.Tests\FluentCassandra.Tests.csproj", "{9DAF7022-5820-4214-B13E-AC0A1B37691F}"
-EndProject
-Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Tools", "Tools", "{AC1223D1-1638-4DEB-9CFF-8B0C43854BB0}"
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FluentCassandra.LinqPad", "utility\FluentCassandra.LinqPad\FluentCassandra.LinqPad.csproj", "{CACA3463-BBEE-4C7E-AC89-49240B0D8F46}"
-EndProject
-Global
- GlobalSection(SolutionConfigurationPlatforms) = preSolution
- Debug|Any CPU = Debug|Any CPU
- Debug|Mixed Platforms = Debug|Mixed Platforms
- Debug|x86 = Debug|x86
- Release|Any CPU = Release|Any CPU
- Release|Mixed Platforms = Release|Mixed Platforms
- Release|x86 = Release|x86
- EndGlobalSection
- GlobalSection(ProjectConfigurationPlatforms) = postSolution
- {9DAF7022-5820-4214-B13E-AC0A1B37691F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {9DAF7022-5820-4214-B13E-AC0A1B37691F}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {9DAF7022-5820-4214-B13E-AC0A1B37691F}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
- {9DAF7022-5820-4214-B13E-AC0A1B37691F}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
- {9DAF7022-5820-4214-B13E-AC0A1B37691F}.Debug|x86.ActiveCfg = Debug|Any CPU
- {9DAF7022-5820-4214-B13E-AC0A1B37691F}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {9DAF7022-5820-4214-B13E-AC0A1B37691F}.Release|Any CPU.Build.0 = Release|Any CPU
- {9DAF7022-5820-4214-B13E-AC0A1B37691F}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
- {9DAF7022-5820-4214-B13E-AC0A1B37691F}.Release|Mixed Platforms.Build.0 = Release|Any CPU
- {9DAF7022-5820-4214-B13E-AC0A1B37691F}.Release|x86.ActiveCfg = Release|Any CPU
- {AC3818E2-E260-4193-A3D1-6E3FF87383F6}.Debug|Any CPU.ActiveCfg = Debug|x86
- {AC3818E2-E260-4193-A3D1-6E3FF87383F6}.Debug|Mixed Platforms.ActiveCfg = Debug|x86
- {AC3818E2-E260-4193-A3D1-6E3FF87383F6}.Debug|Mixed Platforms.Build.0 = Debug|x86
- {AC3818E2-E260-4193-A3D1-6E3FF87383F6}.Debug|x86.ActiveCfg = Debug|x86
- {AC3818E2-E260-4193-A3D1-6E3FF87383F6}.Debug|x86.Build.0 = Debug|x86
- {AC3818E2-E260-4193-A3D1-6E3FF87383F6}.Release|Any CPU.ActiveCfg = Release|x86
- {AC3818E2-E260-4193-A3D1-6E3FF87383F6}.Release|Mixed Platforms.ActiveCfg = Release|x86
- {AC3818E2-E260-4193-A3D1-6E3FF87383F6}.Release|Mixed Platforms.Build.0 = Release|x86
- {AC3818E2-E260-4193-A3D1-6E3FF87383F6}.Release|x86.ActiveCfg = Release|x86
- {AC3818E2-E260-4193-A3D1-6E3FF87383F6}.Release|x86.Build.0 = Release|x86
- {CACA3463-BBEE-4C7E-AC89-49240B0D8F46}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {CACA3463-BBEE-4C7E-AC89-49240B0D8F46}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
- {CACA3463-BBEE-4C7E-AC89-49240B0D8F46}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
- {CACA3463-BBEE-4C7E-AC89-49240B0D8F46}.Debug|x86.ActiveCfg = Debug|Any CPU
- {CACA3463-BBEE-4C7E-AC89-49240B0D8F46}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {CACA3463-BBEE-4C7E-AC89-49240B0D8F46}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
- {CACA3463-BBEE-4C7E-AC89-49240B0D8F46}.Release|Mixed Platforms.Build.0 = Release|Any CPU
- {CACA3463-BBEE-4C7E-AC89-49240B0D8F46}.Release|x86.ActiveCfg = Release|Any CPU
- {DE6B46DE-C37A-49AF-8B9A-B9B6D4F03A55}.Debug|Any CPU.ActiveCfg = Debug|x86
- {DE6B46DE-C37A-49AF-8B9A-B9B6D4F03A55}.Debug|Mixed Platforms.ActiveCfg = Debug|x86
- {DE6B46DE-C37A-49AF-8B9A-B9B6D4F03A55}.Debug|Mixed Platforms.Build.0 = Debug|x86
- {DE6B46DE-C37A-49AF-8B9A-B9B6D4F03A55}.Debug|x86.ActiveCfg = Debug|x86
- {DE6B46DE-C37A-49AF-8B9A-B9B6D4F03A55}.Debug|x86.Build.0 = Debug|x86
- {DE6B46DE-C37A-49AF-8B9A-B9B6D4F03A55}.Release|Any CPU.ActiveCfg = Release|x86
- {DE6B46DE-C37A-49AF-8B9A-B9B6D4F03A55}.Release|Mixed Platforms.ActiveCfg = Release|x86
- {DE6B46DE-C37A-49AF-8B9A-B9B6D4F03A55}.Release|Mixed Platforms.Build.0 = Release|x86
- {DE6B46DE-C37A-49AF-8B9A-B9B6D4F03A55}.Release|x86.ActiveCfg = Release|x86
- {DE6B46DE-C37A-49AF-8B9A-B9B6D4F03A55}.Release|x86.Build.0 = Release|x86
- {EAA32600-3C2A-4B34-B9B2-5764F280FCE3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {EAA32600-3C2A-4B34-B9B2-5764F280FCE3}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {EAA32600-3C2A-4B34-B9B2-5764F280FCE3}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
- {EAA32600-3C2A-4B34-B9B2-5764F280FCE3}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
- {EAA32600-3C2A-4B34-B9B2-5764F280FCE3}.Debug|x86.ActiveCfg = Debug|Any CPU
- {EAA32600-3C2A-4B34-B9B2-5764F280FCE3}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {EAA32600-3C2A-4B34-B9B2-5764F280FCE3}.Release|Any CPU.Build.0 = Release|Any CPU
- {EAA32600-3C2A-4B34-B9B2-5764F280FCE3}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
- {EAA32600-3C2A-4B34-B9B2-5764F280FCE3}.Release|Mixed Platforms.Build.0 = Release|Any CPU
- {EAA32600-3C2A-4B34-B9B2-5764F280FCE3}.Release|x86.ActiveCfg = Release|Any CPU
- EndGlobalSection
- GlobalSection(NestedProjects) = preSolution
- {AC3818E2-E260-4193-A3D1-6E3FF87383F6} = {1A88B962-9A09-4692-80D3-E88712A9E516}
- {9DAF7022-5820-4214-B13E-AC0A1B37691F} = {1A88B962-9A09-4692-80D3-E88712A9E516}
- {CACA3463-BBEE-4C7E-AC89-49240B0D8F46} = {AC1223D1-1638-4DEB-9CFF-8B0C43854BB0}
- EndGlobalSection
- GlobalSection(MonoDevelopProperties) = preSolution
- StartupItem = test\FluentCassandra.Sandbox\FluentCassandra.Sandbox.csproj
- Policies = $0
- $0.DotNetNamingPolicy = $1
- $1.DirectoryNamespaceAssociation = None
- $1.ResourceNamePolicy = FileFormatDefault
- $0.TextStylePolicy = $2
- $2.inheritsSet = null
- $2.scope = text/x-csharp
- $0.CSharpFormattingPolicy = $3
- $3.inheritsSet = Mono
- $3.inheritsScope = text/x-csharp
- $3.scope = text/x-csharp
- $0.StandardHeader = $4
- $4.Text =
- $4.IncludeInNewFiles = True
- $0.VersionControlPolicy = $5
- $5.inheritsSet = Mono
- $0.ChangeLogPolicy = $6
- $6.UpdateMode = None
- $6.MessageStyle = $7
- $7.LineAlign = 0
- $6.inheritsSet = Mono
- version = 1.0.0
- EndGlobalSection
- GlobalSection(TestCaseManagementSettings) = postSolution
- CategoryFile = FluentCassandra.vsmdi
- EndGlobalSection
- GlobalSection(SolutionProperties) = preSolution
- HideSolutionNode = FALSE
- EndGlobalSection
-EndGlobal
+
+Microsoft Visual Studio Solution File, Format Version 11.00
+# Visual Studio 2010
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FluentCassandra", "src\FluentCassandra.csproj", "{EAA32600-3C2A-4B34-B9B2-5764F280FCE3}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FluentCassandra.Sandbox", "test\FluentCassandra.Sandbox\FluentCassandra.Sandbox.csproj", "{DE6B46DE-C37A-49AF-8B9A-B9B6D4F03A55}"
+EndProject
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{53AE6E93-92B4-4D33-9BE5-3CE59C1A2AD6}"
+ ProjectSection(SolutionItems) = preProject
+ FluentCassandra.msbuild = FluentCassandra.msbuild
+ EndProjectSection
+EndProject
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".nuget", ".nuget", "{BF5D399F-A637-4DE2-980F-1CF057A6953C}"
+ ProjectSection(SolutionItems) = preProject
+ .nuget\NuGet.exe = .nuget\NuGet.exe
+ .nuget\NuGet.targets = .nuget\NuGet.targets
+ EndProjectSection
+EndProject
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Tests", "Tests", "{1A88B962-9A09-4692-80D3-E88712A9E516}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FluentCassandra.StressTest", "test\FluentCassandra.StressTest\FluentCassandra.StressTest.csproj", "{AC3818E2-E260-4193-A3D1-6E3FF87383F6}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FluentCassandra.Tests", "test\FluentCassandra.Tests\FluentCassandra.Tests.csproj", "{9DAF7022-5820-4214-B13E-AC0A1B37691F}"
+EndProject
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Tools", "Tools", "{AC1223D1-1638-4DEB-9CFF-8B0C43854BB0}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FluentCassandra.LinqPad", "utility\FluentCassandra.LinqPad\FluentCassandra.LinqPad.csproj", "{CACA3463-BBEE-4C7E-AC89-49240B0D8F46}"
+EndProject
+Global
+ GlobalSection(TestCaseManagementSettings) = postSolution
+ CategoryFile = FluentCassandra.vsmdi
+ EndGlobalSection
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Any CPU = Debug|Any CPU
+ Debug|Mixed Platforms = Debug|Mixed Platforms
+ Debug|x86 = Debug|x86
+ Release|Any CPU = Release|Any CPU
+ Release|Mixed Platforms = Release|Mixed Platforms
+ Release|x86 = Release|x86
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {EAA32600-3C2A-4B34-B9B2-5764F280FCE3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {EAA32600-3C2A-4B34-B9B2-5764F280FCE3}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {EAA32600-3C2A-4B34-B9B2-5764F280FCE3}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
+ {EAA32600-3C2A-4B34-B9B2-5764F280FCE3}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
+ {EAA32600-3C2A-4B34-B9B2-5764F280FCE3}.Debug|x86.ActiveCfg = Debug|Any CPU
+ {EAA32600-3C2A-4B34-B9B2-5764F280FCE3}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {EAA32600-3C2A-4B34-B9B2-5764F280FCE3}.Release|Any CPU.Build.0 = Release|Any CPU
+ {EAA32600-3C2A-4B34-B9B2-5764F280FCE3}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
+ {EAA32600-3C2A-4B34-B9B2-5764F280FCE3}.Release|Mixed Platforms.Build.0 = Release|Any CPU
+ {EAA32600-3C2A-4B34-B9B2-5764F280FCE3}.Release|x86.ActiveCfg = Release|Any CPU
+ {DE6B46DE-C37A-49AF-8B9A-B9B6D4F03A55}.Debug|Any CPU.ActiveCfg = Debug|x86
+ {DE6B46DE-C37A-49AF-8B9A-B9B6D4F03A55}.Debug|Mixed Platforms.ActiveCfg = Debug|x86
+ {DE6B46DE-C37A-49AF-8B9A-B9B6D4F03A55}.Debug|Mixed Platforms.Build.0 = Debug|x86
+ {DE6B46DE-C37A-49AF-8B9A-B9B6D4F03A55}.Debug|x86.ActiveCfg = Debug|x86
+ {DE6B46DE-C37A-49AF-8B9A-B9B6D4F03A55}.Debug|x86.Build.0 = Debug|x86
+ {DE6B46DE-C37A-49AF-8B9A-B9B6D4F03A55}.Release|Any CPU.ActiveCfg = Release|x86
+ {DE6B46DE-C37A-49AF-8B9A-B9B6D4F03A55}.Release|Mixed Platforms.ActiveCfg = Release|x86
+ {DE6B46DE-C37A-49AF-8B9A-B9B6D4F03A55}.Release|Mixed Platforms.Build.0 = Release|x86
+ {DE6B46DE-C37A-49AF-8B9A-B9B6D4F03A55}.Release|x86.ActiveCfg = Release|x86
+ {DE6B46DE-C37A-49AF-8B9A-B9B6D4F03A55}.Release|x86.Build.0 = Release|x86
+ {AC3818E2-E260-4193-A3D1-6E3FF87383F6}.Debug|Any CPU.ActiveCfg = Debug|x86
+ {AC3818E2-E260-4193-A3D1-6E3FF87383F6}.Debug|Mixed Platforms.ActiveCfg = Debug|x86
+ {AC3818E2-E260-4193-A3D1-6E3FF87383F6}.Debug|Mixed Platforms.Build.0 = Debug|x86
+ {AC3818E2-E260-4193-A3D1-6E3FF87383F6}.Debug|x86.ActiveCfg = Debug|x86
+ {AC3818E2-E260-4193-A3D1-6E3FF87383F6}.Debug|x86.Build.0 = Debug|x86
+ {AC3818E2-E260-4193-A3D1-6E3FF87383F6}.Release|Any CPU.ActiveCfg = Release|x86
+ {AC3818E2-E260-4193-A3D1-6E3FF87383F6}.Release|Mixed Platforms.ActiveCfg = Release|x86
+ {AC3818E2-E260-4193-A3D1-6E3FF87383F6}.Release|Mixed Platforms.Build.0 = Release|x86
+ {AC3818E2-E260-4193-A3D1-6E3FF87383F6}.Release|x86.ActiveCfg = Release|x86
+ {AC3818E2-E260-4193-A3D1-6E3FF87383F6}.Release|x86.Build.0 = Release|x86
+ {9DAF7022-5820-4214-B13E-AC0A1B37691F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {9DAF7022-5820-4214-B13E-AC0A1B37691F}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {9DAF7022-5820-4214-B13E-AC0A1B37691F}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
+ {9DAF7022-5820-4214-B13E-AC0A1B37691F}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
+ {9DAF7022-5820-4214-B13E-AC0A1B37691F}.Debug|x86.ActiveCfg = Debug|Any CPU
+ {9DAF7022-5820-4214-B13E-AC0A1B37691F}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {9DAF7022-5820-4214-B13E-AC0A1B37691F}.Release|Any CPU.Build.0 = Release|Any CPU
+ {9DAF7022-5820-4214-B13E-AC0A1B37691F}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
+ {9DAF7022-5820-4214-B13E-AC0A1B37691F}.Release|Mixed Platforms.Build.0 = Release|Any CPU
+ {9DAF7022-5820-4214-B13E-AC0A1B37691F}.Release|x86.ActiveCfg = Release|Any CPU
+ {CACA3463-BBEE-4C7E-AC89-49240B0D8F46}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {CACA3463-BBEE-4C7E-AC89-49240B0D8F46}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
+ {CACA3463-BBEE-4C7E-AC89-49240B0D8F46}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
+ {CACA3463-BBEE-4C7E-AC89-49240B0D8F46}.Debug|x86.ActiveCfg = Debug|Any CPU
+ {CACA3463-BBEE-4C7E-AC89-49240B0D8F46}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {CACA3463-BBEE-4C7E-AC89-49240B0D8F46}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
+ {CACA3463-BBEE-4C7E-AC89-49240B0D8F46}.Release|Mixed Platforms.Build.0 = Release|Any CPU
+ {CACA3463-BBEE-4C7E-AC89-49240B0D8F46}.Release|x86.ActiveCfg = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+ GlobalSection(NestedProjects) = preSolution
+ {AC3818E2-E260-4193-A3D1-6E3FF87383F6} = {1A88B962-9A09-4692-80D3-E88712A9E516}
+ {9DAF7022-5820-4214-B13E-AC0A1B37691F} = {1A88B962-9A09-4692-80D3-E88712A9E516}
+ {CACA3463-BBEE-4C7E-AC89-49240B0D8F46} = {AC1223D1-1638-4DEB-9CFF-8B0C43854BB0}
+ EndGlobalSection
+ GlobalSection(MonoDevelopProperties) = preSolution
+ StartupItem = test\FluentCassandra.Sandbox\FluentCassandra.Sandbox.csproj
+ Policies = $0
+ $0.DotNetNamingPolicy = $1
+ $1.DirectoryNamespaceAssociation = None
+ $1.ResourceNamePolicy = FileFormatDefault
+ $0.TextStylePolicy = $2
+ $2.inheritsSet = null
+ $2.scope = text/x-csharp
+ $0.CSharpFormattingPolicy = $3
+ $3.inheritsSet = Mono
+ $3.inheritsScope = text/x-csharp
+ $3.scope = text/x-csharp
+ $0.StandardHeader = $4
+ $4.Text =
+ $4.IncludeInNewFiles = True
+ $0.VersionControlPolicy = $5
+ $5.inheritsSet = Mono
+ $0.ChangeLogPolicy = $6
+ $6.UpdateMode = None
+ $6.MessageStyle = $7
+ $7.LineAlign = 0
+ $6.inheritsSet = Mono
+ version = 1.0.0
+ EndGlobalSection
+EndGlobal
View
108 src/GuidGenerator.cs
@@ -1,4 +1,5 @@
using System;
+using System.Diagnostics;
namespace FluentCassandra
{
@@ -76,7 +77,7 @@ public static DateTime GetUtcDateTime(Guid guid)
public static Guid GenerateTimeBasedGuid()
{
- return GenerateTimeBasedGuid(DateTimeOffset.UtcNow, RandomNode);
+ return GenerateTimeBasedGuid(new DateTimePrecise(5).UtcNow, RandomNode);
}
public static Guid GenerateTimeBasedGuid(DateTime dateTime)
@@ -120,5 +121,110 @@ public static Guid GenerateTimeBasedGuid(DateTimeOffset dateTime, byte[] node)
return new Guid(guid);
}
+
+ /// DateTimePrecise class in C# -- an improvement to DateTime.Now
+ /// By jamesdbrock
+ /// http://www.codeproject.com/KB/cs/DateTimePrecise.aspx
+ /// Licensed via The Code Project Open License (CPOL) 1.02
+ /// http://www.codeproject.com/info/cpol10.aspx
+ ///
+ /// DateTimePrecise provides a way to get a DateTime that exhibits the
+ /// relative precision of
+ /// System.Diagnostics.Stopwatch, and the absolute accuracy of DateTime.Now.
+ private class DateTimePrecise
+ {
+ /// Creates a new instance of DateTimePrecise.
+ /// A large value of synchronizePeriodSeconds may cause arithmetic overthrow
+ /// exceptions to be thrown. A small value may cause the time to be unstable.
+ /// A good value is 10.
+ /// synchronizePeriodSeconds = The number of seconds after which the
+ /// DateTimePrecise will synchronize itself with the system clock.
+ public DateTimePrecise(long synchronizePeriodSeconds)
+ {
+ Stopwatch = Stopwatch.StartNew();
+ this.Stopwatch.Start();
+
+ DateTime t = DateTime.UtcNow;
+ _immutable = new DateTimePreciseSafeImmutable(t, t, Stopwatch.ElapsedTicks,
+ Stopwatch.Frequency);
+
+ _synchronizePeriodSeconds = synchronizePeriodSeconds;
+ _synchronizePeriodStopwatchTicks = synchronizePeriodSeconds *
+ Stopwatch.Frequency;
+ _synchronizePeriodClockTicks = synchronizePeriodSeconds *
+ _clockTickFrequency;
+ }
+
+ /// Returns the current date and time, just like DateTime.UtcNow.
+ public DateTime UtcNow
+ {
+ get
+ {
+ long s = this.Stopwatch.ElapsedTicks;
+ DateTimePreciseSafeImmutable immutable = _immutable;
+
+ if (s < immutable._s_observed + _synchronizePeriodStopwatchTicks)
+ {
+ return immutable._t_base.AddTicks(((
+ s - immutable._s_observed) * _clockTickFrequency) / (
+ immutable._stopWatchFrequency));
+ }
+ else
+ {
+ DateTime t = DateTime.UtcNow;
+
+ DateTime t_base_new = immutable._t_base.AddTicks(((
+ s - immutable._s_observed) * _clockTickFrequency) / (
+ immutable._stopWatchFrequency));
+
+ _immutable = new DateTimePreciseSafeImmutable(
+ t,
+ t_base_new,
+ s,
+ ((s - immutable._s_observed) * _clockTickFrequency * 2)
+ /
+ (t.Ticks - immutable._t_observed.Ticks + t.Ticks +
+ t.Ticks - t_base_new.Ticks - immutable._t_observed.Ticks)
+ );
+
+ return t_base_new;
+ }
+ }
+ }
+
+ /// Returns the current date and time, just like DateTime.Now.
+ public DateTime Now
+ {
+ get
+ {
+ return this.UtcNow.ToLocalTime();
+ }
+ }
+
+ /// The internal System.Diagnostics.Stopwatch used by this instance.
+ public Stopwatch Stopwatch;
+
+ private long _synchronizePeriodStopwatchTicks;
+ private long _synchronizePeriodSeconds;
+ private long _synchronizePeriodClockTicks;
+ private const long _clockTickFrequency = 10000000;
+ private DateTimePreciseSafeImmutable _immutable;
+ }
+
+ internal sealed class DateTimePreciseSafeImmutable
+ {
+ internal DateTimePreciseSafeImmutable(DateTime t_observed, DateTime t_base,
+ long s_observed, long stopWatchFrequency)
+ {
+ _t_observed = t_observed;
+ _t_base = t_base;
+ _s_observed = s_observed;
+ _stopWatchFrequency = stopWatchFrequency;
+ }
+ internal readonly DateTime _t_observed;
+ internal readonly DateTime _t_base;
+ internal readonly long _s_observed;
+ internal readonly long _stopWatchFrequency;
+ }
}
}
View
8 test/FluentCassandra.StressTest/FluentCassandra.StressTest.csproj
@@ -1,4 +1,4 @@
-<?xml version="1.0" encoding="utf-8"?>
+<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
@@ -43,6 +43,9 @@
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
+ <Reference Include="xunit">
+ <HintPath>..\..\packages\xunit.1.9.0.1566\lib\xunit.dll</HintPath>
+ </Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="Program.cs" />
@@ -54,6 +57,9 @@
<Name>FluentCassandra</Name>
</ProjectReference>
</ItemGroup>
+ <ItemGroup>
+ <None Include="packages.config" />
+ </ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="$(SolutionDir)\.nuget\nuget.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
View
19 test/FluentCassandra.Tests/GuidGeneratorTest.cs
@@ -1,6 +1,8 @@
using System;
using System.Linq;
using Xunit;
+using System.Collections.Generic;
+using System.Collections.Concurrent;
namespace FluentCassandra
{
@@ -90,5 +92,22 @@ public void GetDateTimeOffset()
// assert
Assert.Equal(expected, actual);
}
+
+ [Fact]
+ public void CheckGuidGenerationPararell()
+ {
+ ConcurrentBag<Guid> guidList = new ConcurrentBag<Guid>();
+ List<int> list = new List<int>();
+ for (int i = 0; i < 10; i++)
+ {
+ list.Add(i);
+ }
+ list.AsParallel().ForAll(index => guidList.Add(GuidGenerator.GenerateTimeBasedGuid()));
+
+ var expected = 10;
+ var actual = guidList.Count;
+ // assert
+ Assert.Equal(expected, actual);
+ }
}
}
Something went wrong with that request. Please try again.