diff --git a/C#.NET/source/Yitter.IdGenerator/Core/SnowWorkerM1.cs b/C#.NET/source/Yitter.IdGenerator/Core/SnowWorkerM1.cs
index 919e7e6..1868e31 100644
--- a/C#.NET/source/Yitter.IdGenerator/Core/SnowWorkerM1.cs
+++ b/C#.NET/source/Yitter.IdGenerator/Core/SnowWorkerM1.cs
@@ -5,27 +5,27 @@
* 版权说明:只要保留本版权,你可以免费使用、修改、分发本代码。
* 免责条款:任何因为本代码产生的系统、法律、政治、宗教问题,均与版权所有者无关。
*
- */
-
-using System;
-using System.Threading;
+ */
+
+using System;
+using System.Threading;
using System.Threading.Tasks;
-namespace Yitter.IdGenerator
-{
- ///
- /// 雪花漂移算法
- ///
- internal class SnowWorkerM1 : ISnowWorker
+namespace Yitter.IdGenerator
+{
+ ///
+ /// 雪花漂移算法
+ ///
+ internal class SnowWorkerM1 : ISnowWorker
{
///
/// 基础时间
///
- protected readonly DateTime BaseTime;
+ protected readonly DateTime BaseTime;
- ///
- /// 机器码
- ///
+ ///
+ /// 机器码
+ ///
protected readonly ushort WorkerId = 0;
///
@@ -40,7 +40,7 @@ namespace Yitter.IdGenerator
///
/// 最大序列数(含)
- ///
+ ///
protected readonly int MaxSeqNumber = 0;
///
@@ -57,11 +57,11 @@ namespace Yitter.IdGenerator
protected static object _SyncLock = new object();
protected ushort _CurrentSeqNumber;
- protected long _LastTimeTick = 0; // -1L
- protected long _TurnBackTimeTick = 0; // -1L;
- protected byte _TurnBackIndex = 0;
-
- protected bool _IsOverCost = false;
+ protected long _LastTimeTick = 0; // -1L
+ protected long _TurnBackTimeTick = 0; // -1L;
+ protected byte _TurnBackIndex = 0;
+
+ protected bool _IsOverCost = false;
protected int _OverCostCountInOneTerm = 0;
protected int _GenCountInOneTerm = 0;
protected int _TermIndex = 0;
@@ -71,8 +71,8 @@ namespace Yitter.IdGenerator
public Action GenAction { get; set; }
-
- public SnowWorkerM1(IdGeneratorOptions options)
+
+ public SnowWorkerM1(IdGeneratorOptions options)
{
// 1.BaseTime
if (options.BaseTime != DateTime.MinValue)
@@ -117,17 +117,17 @@ namespace Yitter.IdGenerator
MinSeqNumber = options.MinSeqNumber;
// 7.Others
- TopOverCostCount = options.TopOverCostCount;
+ TopOverCostCount = options.TopOverCostCount;
if (TopOverCostCount == 0)
{
TopOverCostCount = 2000;
}
- _TimestampShift = (byte)(WorkerIdBitLength + SeqBitLength);
- _CurrentSeqNumber = options.MinSeqNumber;
-
- //_BaseTimeTick = BaseTime.Ticks;
- //_StartTimeTick = (long)(DateTime.UtcNow.Subtract(BaseTime).TotalMilliseconds) - Environment.TickCount;
+ _TimestampShift = (byte)(WorkerIdBitLength + SeqBitLength);
+ _CurrentSeqNumber = options.MinSeqNumber;
+
+ //_BaseTimeTick = BaseTime.Ticks;
+ //_StartTimeTick = (long)(DateTime.UtcNow.Subtract(BaseTime).TotalMilliseconds) - Environment.TickCount;
}
@@ -137,7 +137,7 @@ namespace Yitter.IdGenerator
{
GenAction(arg);
});
- }
+ }
private void BeginOverCostAction(in long useTimeTick)
{
@@ -338,11 +338,11 @@ namespace Yitter.IdGenerator
return result;
}
- protected virtual long GetCurrentTimeTick()
- {
- //return (long)(DateTime.UtcNow - BaseTime).Ticks;
- //return (long)(_StartTimeTick + Environment.TickCount);
- return (long)(DateTime.UtcNow - BaseTime).TotalMilliseconds;
+ protected virtual long GetCurrentTimeTick()
+ {
+ //return (long)(DateTime.UtcNow - BaseTime).Ticks;
+ //return (long)(_StartTimeTick + Environment.TickCount);
+ return (long)(DateTime.UtcNow - BaseTime).TotalMilliseconds;
}
protected virtual long GetNextTimeTick()
@@ -364,6 +364,6 @@ namespace Yitter.IdGenerator
{
return _IsOverCost ? NextOverCostId() : NextNormalId();
}
- }
- }
-}
+ }
+ }
+}
diff --git a/Node.js/.gitignore b/JavaScript/.gitignore
similarity index 100%
rename from Node.js/.gitignore
rename to JavaScript/.gitignore
diff --git a/Node.js/README.md b/JavaScript/README.md
similarity index 100%
rename from Node.js/README.md
rename to JavaScript/README.md
diff --git a/Node.js/index.js b/JavaScript/index.js
similarity index 100%
rename from Node.js/index.js
rename to JavaScript/index.js
diff --git a/Node.js/package.json b/JavaScript/package.json
similarity index 100%
rename from Node.js/package.json
rename to JavaScript/package.json
diff --git a/Node.js/test/process_test.js b/JavaScript/test/process_test.js
similarity index 100%
rename from Node.js/test/process_test.js
rename to JavaScript/test/process_test.js
diff --git a/Node.js/test/test.js b/JavaScript/test/test.js
similarity index 100%
rename from Node.js/test/test.js
rename to JavaScript/test/test.js
diff --git a/Node.js/test/test2.js b/JavaScript/test/test2.js
similarity index 100%
rename from Node.js/test/test2.js
rename to JavaScript/test/test2.js