|
@@ -14,8 +14,8 @@ namespace Vit.Core.Util.Guid
|
|
|
// 1 byte 1 byte 4 byte 2 byte
|
|
|
// 机器ID 数据ID 时间 自增
|
|
|
// machineId dataCenterId seconds curId
|
|
|
- private static int machineId= CommonHelp.Random(0, 127);//机器ID
|
|
|
- private static int dataCenterId = CommonHelp.Random(0, 255);//数据ID
|
|
|
+ private static long machineId = CommonHelp.Random(0, 127);//机器ID
|
|
|
+ private static long dataCenterId = CommonHelp.Random(0, 255);//数据ID
|
|
|
//private static int seconds;
|
|
|
private static int curId=0;
|
|
|
|
|
@@ -43,8 +43,8 @@ namespace Vit.Core.Util.Guid
|
|
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
|
public static long GetGuid()
|
|
|
{
|
|
|
- int seconds = (int)(long)GetTimestamp();
|
|
|
- int id= Interlocked.Increment(ref curId);
|
|
|
+ long seconds = (long)GetTimestamp();
|
|
|
+ long id = Interlocked.Increment(ref curId);
|
|
|
return (((((machineId << 8) | dataCenterId) << 32) | seconds) << 8) | id;
|
|
|
}
|
|
|
|